Major update of all demo programs to use new PEP8 bindings, etc

This commit is contained in:
PySimpleGUI 2019-10-23 16:10:03 -04:00
parent 3f7c87c562
commit 7f52778bcc
307 changed files with 19546 additions and 3297 deletions

View file

@ -1,34 +1,37 @@
"""
PySimpleGUI The Complete Course
Lesson 7 - Multiple Windows
"""
import PySimpleGUI as sg
"""
PySimpleGUI The Complete Course
Lesson 7
Multiple Independent Windows
"""
# Design pattern 2 - First window remains active
layout = [[ sg.Text('Window 1'),],
[sg.Input(do_not_clear=True)],
[sg.Text('', size=(20,1), key='_OUTPUT_')],
[sg.Input('')],
[sg.Text('', size=(20,1), key='-OUTPUT-')],
[sg.Button('Launch 2'), sg.Button('Exit')]]
win1 = sg.Window('Window 1').Layout(layout)
window1 = sg.Window('Window 1', layout)
win2_active = False
window2_active = False
while True:
ev1, vals1 = win1.Read(timeout=100)
win1.FindElement('_OUTPUT_').Update(vals1[0])
if ev1 is None or ev1 == 'Exit':
event1, values1 = window1.read(timeout=100)
window1['-OUTPUT-'].update(values1[0])
if event1 is None or event1 == 'Exit':
break
if not win2_active and ev1 == 'Launch 2':
win2_active = True
if not window2_active and event1 == 'Launch 2':
window2_active = True
layout2 = [[sg.Text('Window 2')],
[sg.Button('Exit')]]
win2 = sg.Window('Window 2').Layout(layout2)
window2 = sg.Window('Window 2', layout2)
if win2_active:
ev2, vals2 = win2.Read(timeout=100)
if window2_active:
ev2, vals2 = window2.read(timeout=100)
if ev2 is None or ev2 == 'Exit':
win2_active = False
win2.Close()
window2_active = False
window2.close()
window1.close()