Merge pull request #5785 from PySimpleGUI/Dev-latest

Added output of button click to the window itself
This commit is contained in:
PySimpleGUI 2022-08-14 16:43:53 -04:00 committed by GitHub
commit 433d71421e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -47,6 +47,7 @@ def main():
# The window's layout
layout = [[TextButton(text) for text in button_text],
[sg.Text(k='-STATUS-')],
[sg.Ok(), sg.Exit()]]
window = sg.Window('Custom Mouseover Highlighting Buttons', layout, finalize=True)
@ -70,7 +71,7 @@ def main():
if event[1] == 'EXIT':
window[button_key].update(text_color=sg.theme_button_color_text(), background_color=sg.theme_button_color_background())
else: # a "normal" button click (Text clicked) so print the text which we put into the tuple
print('Button pressed = ', event[1])
window['-STATUS-'].update(f'Button pressed = {event[1]}')
window.close()