Updated to use the more "modern constructs". Changed how keys are named.
This commit is contained in:
parent
f7deaadf97
commit
6c8ddbd93c
|
@ -29,29 +29,29 @@ def ShowMeTheButtons():
|
||||||
toolbar_buttons = [ [sg.Text('Who says Windows have to be ugly when using tkinter?', size=(45,3))],
|
toolbar_buttons = [ [sg.Text('Who says Windows have to be ugly when using tkinter?', size=(45,3))],
|
||||||
[sg.Text('All of these buttons are part of the code itself', size=(45,2))],
|
[sg.Text('All of these buttons are part of the code itself', size=(45,2))],
|
||||||
|
|
||||||
[sg.Button('Next', image_data=image_file_to_bytes(button64, (100,50)),button_color=wcolor, font='Any 15', pad=(0,0), key='_close_'),
|
[sg.Button('Next', image_data=image_file_to_bytes(button64, (100,50)),button_color=wcolor, font='Any 15', pad=(0,0), key='-NEXT-'),
|
||||||
# [sg.Button('Exit', image_data=image_file_to_bytes(black64, (100,50)),button_color=bcolor, font='Any 15', pad=(0,0), key='_close_'),],
|
# [sg.Button('Exit', image_data=image_file_to_bytes(black64, (100,50)),button_color=bcolor, font='Any 15', pad=(0,0), key='_close_'),],
|
||||||
sg.Button('Submit', image_data=image_file_to_bytes(red_pill64, (100,50)),button_color=wcolor, font='Any 15', pad=(0,0), key='_close_'),
|
sg.Button('Submit', image_data=image_file_to_bytes(red_pill64, (100,50)),button_color=wcolor, font='Any 15', pad=(0,0), key='-SUBMIT-'),
|
||||||
sg.Button('OK', image_data=image_file_to_bytes(green_pill64, (100,50)),button_color=bcolor, font='Any 15', pad=(0,0), key='_close_'),
|
sg.Button('OK', image_data=image_file_to_bytes(green_pill64, (100,50)),button_color=bcolor, font='Any 15', pad=(0,0), key='-OK-'),
|
||||||
sg.Button('Exit', image_data=image_file_to_bytes(orange64, (100,50)),button_color=bcolor, font='Any 15', pad=(0,0), key='_close_'),],
|
sg.Button('Exit', image_data=image_file_to_bytes(orange64, (100,50)),button_color=bcolor, font='Any 15', pad=(0,0), key='-EXIT-'),],
|
||||||
]
|
]
|
||||||
|
|
||||||
# layout = toolbar_buttons
|
# layout = toolbar_buttons
|
||||||
layout = [[sg.Frame('Nice Buttons', toolbar_buttons, font=('any 18'), background_color='black')]]
|
layout = [[sg.Frame('Nice Buttons', toolbar_buttons, font=('any 18'), background_color='black')]]
|
||||||
|
|
||||||
window = sg.Window('Demo of Nice Looking Buttons',
|
window = sg.Window('Demo of Nice Looking Buttons', layout,
|
||||||
no_titlebar=False,
|
no_titlebar=False,
|
||||||
grab_anywhere=True,
|
grab_anywhere=True,
|
||||||
keep_on_top=True,
|
keep_on_top=True,
|
||||||
use_default_focus=False,
|
use_default_focus=False,
|
||||||
font='any 15',
|
font='any 15',
|
||||||
background_color='black').Layout(layout).Finalize()
|
background_color='black', finalize=True)
|
||||||
|
|
||||||
# ---===--- Loop taking in user input --- #
|
# ---===--- Loop taking in user input --- #
|
||||||
while True:
|
while True:
|
||||||
button, value = window.Read()
|
event, values = window.Read()
|
||||||
print(button)
|
print(event)
|
||||||
if button == '_close_' or button is None:
|
if event in ('-EXIT-', None):
|
||||||
break # exit button clicked
|
break # exit button clicked
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue