From 6270a05eea0cf2624349ccd57e4e0724dbd54b5c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 1 Dec 2018 14:37:35 -0500 Subject: [PATCH] Checking for keys in a more portable way. --- DemoPrograms/Demo_Input_Auto_Complete.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/DemoPrograms/Demo_Input_Auto_Complete.py b/DemoPrograms/Demo_Input_Auto_Complete.py index db95b0b1..04a0c436 100644 --- a/DemoPrograms/Demo_Input_Auto_Complete.py +++ b/DemoPrograms/Demo_Input_Auto_Complete.py @@ -69,10 +69,10 @@ while True: # Event Loop if event == '_COMBO_': sg.Popup('Chose', values['_COMBO_']) - if event == 'Down:40': + if event.startswith('Down'): sel_item = sel_item + (sel_item0) list_elem.Update(set_to_index=sel_item) if event == '\r' or event == 'Show': @@ -80,14 +80,13 @@ while True: # Event Loop window.Element('_INPUT_').Update(vals2['_FLOATING_LISTBOX_'], select=True) fwindow.Close() sel_item = -1 - if event == 'Escape:27': + if event.startswith('Escape'): window.Element('_INPUT_').Update('') try: - ev2, vals2 = fwindow.Read(timeout=100) + ev2, vals2 = fwindow.Read(timeout=10) if ev2 != sg.TIMEOUT_KEY: fwindow.Close() - # sg.Popup('Chose from window', vals2['_FLOATING_LISTBOX_']) window.Element('_INPUT_').Update(vals2['_FLOATING_LISTBOX_'], select=True) sel_item = -1