WIN_CLOSED bulk update. No more test for event is None, use WIN_CLOSED instead

This commit is contained in:
PySimpleGUI 2020-05-07 06:22:59 -04:00
parent 6174b355a6
commit 0076b461f5
135 changed files with 395 additions and 349 deletions

View file

@ -5,12 +5,12 @@ import re
Demo of using a borderless window to show possible matches for autocomplete feature
'''
def autocomplete_popup_show(text_list):
layout = [[ sg.Listbox(values=text_list,
size=(15, len(text_list)),
change_submits=True, bind_return_key=True,
key='-FLOATING-LISTBOX-', enable_events=True) ]]
return sg.Window("Borderless Window",
layout,
default_element_size=(12, 1),
@ -22,7 +22,6 @@ def autocomplete_popup_show(text_list):
default_button_element_size=(12, 1),
location=(1320, 622), finalize=True)
def predict_text(input, lista):
pattern = re.compile('.*' + input + '.*')
return [w for w in lista if re.match(pattern, w)]
@ -43,7 +42,7 @@ def main():
while True: # Event Loop
event, values = window.read(timeout=500)
if event in (None, 'Exit'):
if event in (sg.WIN_CLOSED, 'Exit'):
break
if event != sg.TIMEOUT_KEY: