From fb5fdbdd5ce9dc12fa4d56007a7075f445109f72 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Sat, 22 Apr 2023 10:13:36 -0400 Subject: [PATCH] Moved update animation call to after check for window closed. Was getting an error because attempt to update animation was happening after window was closed --- DemoPrograms/Demo_All_Elements.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/DemoPrograms/Demo_All_Elements.py b/DemoPrograms/Demo_All_Elements.py index a39c6b98..4566c226 100644 --- a/DemoPrograms/Demo_All_Elements.py +++ b/DemoPrograms/Demo_All_Elements.py @@ -11,7 +11,7 @@ Displays the values dictionary entry for each element And more! - Copyright 2021, 2022 PySimpleGUI + Copyright 2021, 2022, 2023 PySimpleGUI """ import PySimpleGUI as sg @@ -94,12 +94,11 @@ def make_window(theme): def main(): window = make_window(sg.theme()) - + # This is an Event Loop while True: event, values = window.read(timeout=100) # keep an animation running so show things are happening - window['-GIF-IMAGE-'].update_animation(sg.DEFAULT_BASE64_LOADING_GIF, time_between_frames=100) if event not in (sg.TIMEOUT_EVENT, sg.WIN_CLOSED): print('============ Event = ', event, ' ==============') print('-------- Values Dictionary (key=value) --------') @@ -108,7 +107,9 @@ def main(): if event in (None, 'Exit'): print("[LOG] Clicked Exit!") break - elif event == 'About': + + window['-GIF-IMAGE-'].update_animation(sg.DEFAULT_BASE64_LOADING_GIF, time_between_frames=100) + if event == 'About': print("[LOG] Clicked About!") sg.popup('PySimpleGUI Demo All Elements', 'Right click anywhere to see right click menu',