Added a function around the functional example
This commit is contained in:
parent
b62648aa23
commit
eeb95398e0
|
@ -9,7 +9,7 @@ import PySimpleGUI as sg
|
|||
GUI frameworks use, but there is no advantage to structuring you code in his manner. It adds
|
||||
confusion, not clarity.
|
||||
|
||||
The class version is 18 lines of code. The plain version is 11 lines of code.
|
||||
The class version is 18 lines of code. The plain version is 13 lines of code.
|
||||
|
||||
Two things about the class wrapper jump out as adding confusion:
|
||||
1. Unneccessary fragmentation of the event loop - the button click code is pulled out of the loop entirely
|
||||
|
@ -83,6 +83,7 @@ my_gui.run()
|
|||
MMMMMMMMMMM
|
||||
'''
|
||||
|
||||
def gui_function():
|
||||
layout = [ [sg.Text('My layout')],
|
||||
[sg.Input(key='-IN-')],
|
||||
[sg.Button('Go'), sg.Button('Exit')] ]
|
||||
|
@ -99,3 +100,4 @@ while True: # Event Loop
|
|||
|
||||
window.close()
|
||||
|
||||
gui_function()
|
||||
|
|
Loading…
Reference in New Issue