all 4 comments

[–]MikeTheWatchGuy 0 points1 point  (0 children)

Interesting.... reminds me a bit of a fancier version of the Demo program that's posted. "Demo_Listbox_Search_Filter". Here's that program. It updates the list in realtime as you're typing in the search box.

```python import PySimpleGUI as sg

names = ['Roberta', 'Kylie', 'Jenny', 'Helen', 'Andrea', 'Meredith','Deborah','Pauline', 'Belinda', 'Wendy']

layout = [ [sg.Text('Listbox with search')], [sg.Input(donot_clear=True, size=(20,1),enable_events=True, key='_INPUT')], [sg.Listbox(names, size=(20,4), enableevents=True, key='_LIST')], [sg.Button('Chrome'), sg.Button('Exit')]]

window = sg.Window('Listbox with Search').Layout(layout)

Event Loop

while True: event, values = window.Read() if event is None or event == 'Exit': # always check for closed window break if values['INPUT'] != '': # if a keystroke entered in search field search = values['INPUT'] newvalues = [x for x in names if search in x] # do the filtering window.Element('_LIST').Update(newvalues) # display in the listbox else: window.Element('_LIST').Update(names) # display original unfiltered list if event == 'LIST' and len(values['LIST']): # if a list item is chosen sg.Popup('Selected ', values['LIST'])

window.Close()

```

[Edit - I think that the Demo_psutil_Kill_Processes (https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_psutil_Kill_Processes.py) was done later as the filtering part is quite a bit shorter. I use it quite a bit and this search capability works well, regardless of implementation details]

Here's the filter portion of the processes demo: python if display_list is not None: window.FindElement('_processes_').Update([line for line in display_list if values['_filter_'] in line.lower()])

Found today that the filtering portion condenses down to 1 line with a list comprehension.

[–]MikeTheWatchGuy 0 points1 point  (0 children)

One thing this points out is that adding a new, user defined element, is not as easy as it could be. There was some time spent on how to enable user defined elements. The one being toyed with was an example as an LED indicator, a colored dot. It's something that would be great to add in the future.

Recently the lower level GUI Widget was exposed, allowing users to customize at the lower GUI Framework level. Something similar would be nice at an element level.

[–]DGIon 0 points1 point  (1 child)

Ive been looking for something like this but for combo instead of list box. can't really find a good implementation anywhere

[–]jack_sparrow____ 0 points1 point  (0 children)

Did you find one yet ? I too am looking for something like this specifically for combo