Major demo refresh.. switched everything to new function names, new design patterns

Out with the old, in with the new!!
This commit is contained in:
MikeTheWatchGuy 2018-09-24 18:01:00 -04:00
parent 2a06683383
commit a1f4c60271
68 changed files with 706 additions and 1863 deletions

View file

@ -7,9 +7,9 @@ import PySimpleGUI as sg
sg.SetOptions(element_padding=(0,0))
# sg.ChangeLookAndFeel('Dark')
# --- Define our "Big-Button-Spinner" compound element. Has 2 buttons and an input field --- #
NewSpinner = [sg.ReadFormButton('-', size=(2,1), font='Any 12'),
NewSpinner = [sg.ReadButton('-', size=(2,1), font='Any 12'),
sg.In('0', size=(2,1), font='Any 14', justification='r', key='spin'),
sg.ReadFormButton('+', size=(2,1), font='Any 12')]
sg.ReadButton('+', size=(2,1), font='Any 12')]
# --- Define Window --- #
layout = [
[sg.Text('Spinner simulation')],
@ -18,17 +18,16 @@ layout = [
[sg.Ok()]
]
form = sg.FlexForm('Spinner simulation')
form.Layout(layout)
window = sg.Window('Spinner simulation').Layout(layout)
# --- Event Loop --- #
counter = 0
while True:
button, value = form.Read()
button, value = window.Read()
if button == 'Ok' or button is None: # be nice to your user, always have an exit from your form
break
# --- do spinner stuff --- #
counter += 1 if button =='+' else -1 if button == '-' else 0
form.FindElement('spin').Update(counter)
window.FindElement('spin').Update(counter)