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:
parent
2a06683383
commit
a1f4c60271
68 changed files with 706 additions and 1863 deletions
|
@ -1,11 +1,8 @@
|
|||
import PySimpleGUI as sg
|
||||
|
||||
"""
|
||||
Turn off padding in order to get a really tight looking layout.
|
||||
"""
|
||||
|
||||
sg.ChangeLookAndFeel('Dark')
|
||||
sg.SetOptions(element_padding=(0, 0))
|
||||
|
||||
layout = [
|
||||
[sg.T('Notes:', pad=((3, 0), 0)), sg.In(size=(44, 1), background_color='white', text_color='black', key='notes')],
|
||||
[sg.T('Output:', pad=((3, 0), 0)), sg.T('', size=(44, 1), text_color='white', key='output')],
|
||||
|
@ -14,56 +11,28 @@ layout = [
|
|||
[sg.Spin((1,2,3,4),1, key='spin'), sg.OptionMenu((1,2,3,4), key='option'), sg.Combo(values=(1,2,3,4),key='combo')],
|
||||
[sg.Multiline('Multiline', size=(20,3), key='multi')],
|
||||
[sg.Slider((1,10), size=(20,20), orientation='h', key='slider')],
|
||||
[sg.ReadFormButton('Enable', button_color=('white', 'black')),
|
||||
sg.ReadFormButton('Disable', button_color=('white', 'black')),
|
||||
sg.ReadFormButton('Reset', button_color=('white', '#9B0023'), key='reset'),
|
||||
sg.ReadFormButton('Values', button_color=('white', 'springgreen4')),
|
||||
sg.SimpleButton('Exit', button_color=('white', '#00406B'))]]
|
||||
[sg.ReadButton('Enable', button_color=('white', 'black')),
|
||||
sg.ReadButton('Disable', button_color=('white', 'black')),
|
||||
sg.ReadButton('Reset', button_color=('white', '#9B0023'), key='reset'),
|
||||
sg.ReadButton('Values', button_color=('white', 'springgreen4')),
|
||||
sg.Button('Exit', button_color=('white', '#00406B'))]]
|
||||
|
||||
form = sg.FlexForm("Disable Elements Demo", default_element_size=(12, 1), text_justification='r', auto_size_text=False,
|
||||
window = sg.Window("Disable Elements Demo", default_element_size=(12, 1), text_justification='r', auto_size_text=False,
|
||||
auto_size_buttons=False, keep_on_top=True, grab_anywhere=False,
|
||||
default_button_element_size=(12, 1)).Layout(layout).Finalize()
|
||||
|
||||
form.FindElement('cbox').Update(disabled=True)
|
||||
form.FindElement('listbox').Update(disabled=True)
|
||||
form.FindElement('radio1').Update(disabled=True)
|
||||
form.FindElement('radio2').Update(disabled=True)
|
||||
form.FindElement('spin').Update(disabled=True)
|
||||
form.FindElement('option').Update(disabled=True)
|
||||
form.FindElement('combo').Update(disabled=True)
|
||||
form.FindElement('reset').Update(disabled=True)
|
||||
form.FindElement('notes').Update(disabled=True)
|
||||
form.FindElement('multi').Update(disabled=True)
|
||||
form.FindElement('slider').Update(disabled=True)
|
||||
key_list = 'cbox', 'listbox', 'radio1', 'radio2', 'spin', 'option', 'combo', 'reset', 'notes', 'multi', 'slider'
|
||||
|
||||
for key in key_list: window.FindElement(key).Update(disabled=True) # don't do this kind of for-loop
|
||||
|
||||
while True:
|
||||
button, values = form.Read()
|
||||
button, values = window.Read()
|
||||
if button is None or button == 'Exit':
|
||||
break
|
||||
elif button == 'Disable':
|
||||
form.FindElement('cbox').Update(disabled=True)
|
||||
form.FindElement('listbox').Update(disabled=True)
|
||||
form.FindElement('radio1').Update(disabled=True)
|
||||
form.FindElement('radio2').Update(disabled=True)
|
||||
form.FindElement('spin').Update(disabled=True)
|
||||
form.FindElement('option').Update(disabled=True)
|
||||
form.FindElement('combo').Update(disabled=True)
|
||||
form.FindElement('reset').Update(disabled=True)
|
||||
form.FindElement('notes').Update(disabled=True)
|
||||
form.FindElement('multi').Update(disabled=True)
|
||||
form.FindElement('slider').Update(disabled=True)
|
||||
for key in key_list: window.FindElement(key).Update(disabled=True)
|
||||
elif button == 'Enable':
|
||||
form.FindElement('cbox').Update(disabled=False)
|
||||
form.FindElement('listbox').Update(disabled=False)
|
||||
form.FindElement('radio1').Update(disabled=False)
|
||||
form.FindElement('radio2').Update(disabled=False)
|
||||
form.FindElement('spin').Update(disabled=False)
|
||||
form.FindElement('option').Update(disabled=False)
|
||||
form.FindElement('combo').Update(disabled=False)
|
||||
form.FindElement('reset').Update(disabled=False)
|
||||
form.FindElement('notes').Update(disabled=False)
|
||||
form.FindElement('multi').Update(disabled=False)
|
||||
form.FindElement('slider').Update(disabled=False)
|
||||
for key in key_list: window.FindElement(key).Update(disabled=False)
|
||||
elif button == 'Values':
|
||||
sg.Popup(values, keep_on_top=True)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue