Demo updates with new theme calls
This commit is contained in:
parent
52700b0780
commit
5484b047c0
96 changed files with 3530 additions and 228 deletions
|
@ -20,40 +20,43 @@ def second_window():
|
|||
|
||||
def test_menus():
|
||||
|
||||
sg.change_look_and_feel('LightGreen')
|
||||
sg.theme('LightGreen')
|
||||
sg.set_options(element_padding=(0, 0))
|
||||
|
||||
# ------ Menu Definition ------ #
|
||||
menu_def = [['&File', ['&Open', '&Save', '&Properties', 'E&xit']],
|
||||
menu_def = [['&File', ['&Open Ctrl-O', '&Save Ctrl-S', '&Properties', 'E&xit']],
|
||||
['&Edit', ['&Paste', ['Special', 'Normal', ], 'Undo'], ],
|
||||
['&Toolbar', ['---', 'Command &1', 'Command &2',
|
||||
'---', 'Command &3', 'Command &4']],
|
||||
['&Help', '&About...'], ]
|
||||
|
||||
right_click_menu = ['Unused', ['Right', '!&Click', '&Menu', 'E&xit', 'Properties']]
|
||||
|
||||
# ------ GUI Defintion ------ #
|
||||
layout = [
|
||||
[sg.Menu(menu_def, tearoff=False, pad=(20, 1))],
|
||||
[sg.Menu(menu_def, tearoff=False, pad=(200, 1))],
|
||||
[sg.Text('Right click me for a right click menu example')],
|
||||
[sg.Output(size=(60, 20))],
|
||||
[sg.ButtonMenu('ButtonMenu', right_click_menu, key='-BMENU-'), sg.Button('Plain Button')],
|
||||
]
|
||||
|
||||
window = sg.Window("Windows-like program",
|
||||
layout,
|
||||
default_element_size=(12, 1),
|
||||
auto_size_text=False,
|
||||
auto_size_buttons=False,
|
||||
default_button_element_size=(12, 1))
|
||||
default_button_element_size=(12, 1),
|
||||
right_click_menu=right_click_menu)
|
||||
|
||||
# ------ Loop & Process button menu choices ------ #
|
||||
while True:
|
||||
event, values = window.read()
|
||||
if event in (None, 'Exit'):
|
||||
return
|
||||
print('Event = ', event)
|
||||
break
|
||||
print(event, values)
|
||||
# ------ Process menu choices ------ #
|
||||
if event == 'About...':
|
||||
window.disappear()
|
||||
sg.popup('About this program', 'Version 1.0',
|
||||
'PySimpleGUI rocks...', grab_anywhere=True)
|
||||
'PySimpleGUI Version', sg.version, grab_anywhere=True)
|
||||
window.reappear()
|
||||
elif event == 'Open':
|
||||
filename = sg.popup_get_file('file to open', no_window=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue