Merge pull request #1273 from PySimpleGUI/Dev-latest

Made Window 1 a blocking Read
This commit is contained in:
MikeTheWatchGuy 2019-03-31 10:25:38 -04:00 committed by GitHub
commit bfc616e080
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 34 deletions

View File

@ -1,6 +1,6 @@
import PySimpleGUI as sg
layout = [[ sg.Text('Window 1'),],
layout = [[sg.Text('Window 1'), ],
[sg.Input(do_not_clear=True)],
[sg.Text('', key='_OUTPUT_')],
[sg.Button('Next >'), sg.Button('Exit')]]
@ -9,7 +9,8 @@ win1 = sg.Window('Window 1').Layout(layout)
win3_active = win2_active = False
while True:
ev1, vals1 = win1.Read(timeout=100)
if not win2_active:
ev1, vals1 = win1.Read()
if ev1 is None or ev1 == 'Exit':
break
win1.FindElement('_OUTPUT_').Update(vals1[0])
@ -38,8 +39,10 @@ while True:
if win3_active:
ev3, vals3 = win3.Read()
if ev3 in (None, 'Exit', '< Prev'):
if ev3 == '< Prev':
win3.Close()
win3_active = False
win2_active = True
win2.UnHide()
elif ev3 in (None, 'Exit'):
break