Major update of all demo programs to use new PEP8 bindings, etc
This commit is contained in:
parent
3f7c87c562
commit
7f52778bcc
307 changed files with 19546 additions and 3297 deletions
|
@ -1,37 +1,38 @@
|
|||
#!/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 of how to combine elements into your own custom element
|
||||
"""
|
||||
|
||||
sg.SetOptions(element_padding=(0,0))
|
||||
# sg.ChangeLookAndFeel('Dark')
|
||||
sg.set_options(element_padding=(0, 0))
|
||||
# sg.change_look_and_feel('Dark')
|
||||
# --- Define our "Big-Button-Spinner" compound element. Has 2 buttons and an input field --- #
|
||||
NewSpinner = [sg.Button('-', size=(2,1), font='Any 12'),
|
||||
sg.In('0', size=(2,1), font='Any 14', justification='r', key='spin'),
|
||||
sg.Button('+', size=(2,1), font='Any 12')]
|
||||
NewSpinner = [sg.Button('-', size=(2, 1), font='Any 12'),
|
||||
sg.Input('0', size=(2, 1), font='Any 14',
|
||||
justification='r', key='spin'),
|
||||
sg.Button('+', size=(2, 1), font='Any 12')]
|
||||
# --- Define Window --- #
|
||||
layout = [
|
||||
[sg.Text('Spinner simulation')],
|
||||
NewSpinner,
|
||||
[sg.T('')],
|
||||
[sg.Ok()]
|
||||
]
|
||||
[sg.Text('Spinner simulation')],
|
||||
NewSpinner,
|
||||
[sg.Text('')],
|
||||
[sg.Ok()]
|
||||
]
|
||||
|
||||
window = sg.Window('Spinner simulation', layout)
|
||||
|
||||
window = sg.Window('Spinner simulation').Layout(layout)
|
||||
|
||||
# --- Event Loop --- #
|
||||
counter = 0
|
||||
while True:
|
||||
event, values = window.Read()
|
||||
event, values = window.read()
|
||||
|
||||
if event == 'Ok' or event is None: # be nice to your user, always have an exit from your form
|
||||
break
|
||||
|
||||
# --- do spinner stuff --- #
|
||||
counter += 1 if event == '+' else -1 if event == '-' else 0
|
||||
window.FindElement('spin').Update(counter)
|
||||
window['spin'].update(counter)
|
||||
|
||||
window.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue