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,10 +1,6 @@
#!/usr/bin/env python
import sys
if sys.version_info[0] >= 3:
import PySimpleGUI as sg
else:
import PySimpleGUI27 as sg
import PySimpleGUI as sg
"""
Demo Button Function Calls
@ -18,21 +14,24 @@ It is quite easy to simulate these callbacks however. The way to do this is to
to your Event Loop
"""
def callback_function1():
sg.Popup('In Callback Function 1')
sg.popup('In Callback Function 1')
print('In the callback function 1')
def callback_function2():
sg.Popup('In Callback Function 2')
sg.popup('In Callback Function 2')
print('In the callback function 2')
layout = [ [sg.Text('Demo of Button Callbacks')],
[sg.Button('Button 1'), sg.Button('Button 2')] ]
window = sg.Window('Button Callback Simulation').Layout(layout)
layout = [[sg.Text('Demo of Button Callbacks')],
[sg.Button('Button 1'), sg.Button('Button 2')]]
window = sg.Window('Button Callback Simulation', layout)
while True: # Event Loop
event, values = window.Read()
event, values = window.read()
if event is None:
break
elif event == 'Button 1':
@ -40,4 +39,4 @@ while True: # Event Loop
elif event == 'Button 2':
callback_function2() # call the "Callback" function
window.Close()
window.close()