MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / main

Function main

DemoPrograms/Demo_Design_Pattern_Multiple_Windows1.py:34–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32
33
34def main():
35 # Design pattern 1 - First window does not remain active
36 window2 = None
37 window1 = make_window1()
38
39 while True:
40 window, event, values = sg.read_all_windows()
41 if event == sg.WIN_CLOSED and window == window1:
42 break
43
44 if window == window1:
45 window1['-OUTPUT-'].update(values['-IN-'])
46
47 if event == 'Launch 2' and not window2:
48 window1.hide()
49 window2 = make_window2()
50
51 if window == window2 and (event in (sg.WIN_CLOSED, 'Exit')):
52 window2.close()
53 window2 = None
54 window1.un_hide()
55 window1.close()
56
57
58if __name__ == '__main__':

Calls 6

make_window1Function · 0.70
make_window2Function · 0.70
updateMethod · 0.45
hideMethod · 0.45
closeMethod · 0.45
un_hideMethod · 0.45

Tested by

no test coverage detected