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,22 +1,18 @@
#!/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
layout = [
[sg.Canvas(size=(150, 150), background_color='red', key='canvas')],
[sg.T('Change circle color to:'), sg.Button('Red'), sg.Button('Blue')]
]
[sg.Canvas(size=(150, 150), background_color='red', key='canvas')],
[sg.Text('Change circle color to:'), sg.Button('Red'), sg.Button('Blue')]
]
window = sg.Window('Canvas test').Layout(layout).Finalize()
window = sg.Window('Canvas test', layout, finalize=True)
cir = window.FindElement('canvas').TKCanvas.create_oval(50, 50, 100, 100)
cir = window['canvas'].TKCanvas.create_oval(50, 50, 100, 100)
while True:
event, values = window.Read()
event, values = window.read()
if event is None:
break
if event in ('Blue', 'Red'):
window.FindElement('canvas').TKCanvas.itemconfig(cir, fill=event)
window['canvas'].TKCanvas.itemconfig(cir, fill=event)