Used new Find Element with Focus. Was able to change 1 ReadNonBlocking into read with timeout
This commit is contained in:
parent
23027173a5
commit
82bb58a97f
|
@ -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':
|
||||||
|
|
Loading…
Reference in New Issue