Used new Find Element with Focus. Was able to change 1 ReadNonBlocking into read with timeout

This commit is contained in:
MikeTheWatchGuy 2018-10-19 18:48:42 -04:00
parent 23027173a5
commit 82bb58a97f
1 changed files with 3 additions and 3 deletions

View File

@ -61,8 +61,8 @@ class keyboard():
class GUI(): class GUI():
def __init__(self): def __init__(self):
layout = [[sg.Text('Enter Text')], layout = [[sg.Text('Enter Text')],
[sg.Input(size=(17, 1), key='input1', )], [sg.Input(size=(17, 1), key='input1', do_not_clear=True )],
[sg.InputText(size=(17, 1), key='input2')], [sg.InputText(size=(17, 1), key='input2', do_not_clear=True)],
[sg.ReadButton('on-screen keyboard', key='keyboard')], [sg.ReadButton('on-screen keyboard', key='keyboard')],
[sg.ReadButton('close', key='close')]] [sg.ReadButton('close', key='close')]]
@ -75,7 +75,7 @@ class GUI():
cur_focus = self.mainWindow.FindElementWithFocus() cur_focus = self.mainWindow.FindElementWithFocus()
if cur_focus is not None: if cur_focus is not None:
self.focus = cur_focus self.focus = cur_focus
event, values = self.mainWindow.ReadNonBlocking() event, values = self.mainWindow.Read(timeout=200, timeout_key='timeout')
if self.focus is not None: if self.focus is not None:
self.keyboard.update(self.focus) self.keyboard.update(self.focus)
if event == 'keyboard': if event == 'keyboard':