diff --git a/DemoPrograms/Demo_Window_Timer.py b/DemoPrograms/Demo_Window_Timer.py index e2e29a8a..cde92686 100644 --- a/DemoPrograms/Demo_Window_Timer.py +++ b/DemoPrograms/Demo_Window_Timer.py @@ -13,7 +13,7 @@ import PySimpleGUI as sg def main(): layout = [ [sg.Text('Demonatrataion of Window Timers', font='_ 15')], [sg.T('Timer duration in ms:'), sg.Input(1000, key='-DURATION-', s=4), sg.Checkbox('Repeats', True, key='-REPEATS-'), sg.Button('Start')], - [sg.T('Timer ID to stop:'), sg.Input(key='-STOP-', s=4), sg.Button('Stop')], + [sg.T('Timer ID to stop:'), sg.Input(key='-STOP-', s=4), sg.Button('Stop'), sg.B('Stop All')], [sg.Output(size=(90, 10))], [sg.Button('Does nothing'), sg.Button('Exit')] ] @@ -30,13 +30,14 @@ def main(): except: continue window.timer_start(duration, repeating=values['-REPEATS-']) - if event == 'Stop': + elif event == 'Stop': try: id = int(values['-STOP-']) except: continue window.timer_stop(id) - + elif event == 'Stop All': + window.timer_stop_all() window.close() diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 740ef4ec..a10928ab 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -version = __version__ = "4.60.4.131 Unreleased" +version = __version__ = "4.60.4.132 Unreleased" _change_log = """ Changelog since 4.60.0 released to PyPI on 8-May-2022 @@ -329,6 +329,8 @@ _change_log = """ New coupon 4.60.4.131 Window timers feature added. Get a single or repeating timer events for your Window by calling window.timer_start + 4.60.4.132 + Added the Window.stop_all method to stop all timers for a window """ __version__ = version.split()[0] # For PEP 396 and PEP 345 @@ -12504,6 +12506,16 @@ class Window: _TimerPeriodic.stop_timer_with_id(timer_id) + + + def timer_stop_all(self): + """ + Stops all timers for THIS window + """ + _TimerPeriodic.stop_all_timers_for_window(self) + + + @classmethod def _restore_stdout(cls): for item in cls._rerouted_stdout_stack: @@ -26187,4 +26199,4 @@ if __name__ == '__main__': exit(0) main() exit(0) -#3ff6807c014e6560182bf226ff1b5befbbead626e81404cf76320287f4a2d3d069f7f8dba2a6dfdc6071bc1f7b1706316c9d7a7d4f2076c9635f33c1714911d933b80abb69837ab820de86a1667d4025a84b092b802a18b4241bc1d2621a30824b02f32805553f112a1362d16f0916a71abe7417b018ac051b61ae962ebd6e627247613061aed8fabf40dde0acfe532e82e10ad5d46ceceb5ed1563e2f54748dd1d166b5d696a9a4e50e68cc7ead983f68b1f58aa1bfce832ab2eb2e62668ba224b73022989a8e124bac47c82494a071c2d15ac5b57ca61173c7e1c581579d3cc6462dac8cf9ec7f6a5a95ebba7cc5085fc408440c914f7eb1545c989029a7c5ca0f3d67a4775fb9164eb1a4d28de482cfc215c7d9cc1b6e869fcf11bb0e8e0b629ca4182cf69faa11d22b77b641d6c3b9de153eb33732765bf38a4f012b4bbc5ec154c48f24e74f57ae22ea0b8e74786b7ee3f63551a8e4bee033f2c44aed0c77e7962cf02cb850247f836d9e82313ea90250b41aecd2ab9ffda2c55e19a6e3f915379806fb1c00ad8df27880b6d375c596618b06a0e669f9ef45039c21be7ce5b08cec082efad0acdad507b73e48d3c9f1bc6e1ae889922683041202737f834323da39298039f512f42fa1a70559a80fcdae882ea702c81f0dd5283bc4bae41c787af976de3aa3bb95118fe0f02fdd14f22227e9b5768906a50d475703df83 \ No newline at end of file +#57ea2c359c043383ee7f73859e53c6734e324734b0c2708eab571a563e0e97a18386d86b7e99fd8c0ab4a9edbe4d69fc486ee7e2e6af1612de83907a00c156d324a09a6503aef0c8e239337b874bcd0be9b1af10742ab0fd7c360c7c9cc3251d04c30849cb12606a4e8132ccd36dc49229180fb3f76f766faaedb5d4c421de4234483d18702ec82660beba58506dc228a61503814368c8e721a6093e83062ad93612a08f726ef089c977b1a02e65742f2841ffc6621b10772a8f714c116525ab70e80d2a12d36e5b50fa48482227fa95554a1bdbe964737185c4d3349ba08c3278ebf1a049127d5a6aa0198d31f8c85dc3895b870908d5e1b46192f6e0f6b6addfaf5b84e46bdc98e9e1cbdb9911d62fc421fee8092fad40d285106679024bbde0a2fd9993c3c7977f223668c48b036416863a6694ce083b8396ede2e637809a5e7897947e97f717a604ae52039be4b76b168d1bfaa83998a1373da26ffdcf1d1ef219701fb5c03a6d937da3287f9b9c8af1c53c694f2e73946415d7883126b9807490c521d4313a0be3e3a24876442adfb08a8751b51a71942f83e74b086c427bcf28c92a4a3fe7648ea7c46c5c9ea5745dd80098229d994639cb59fe5760b031421ac8a0f941b2248a94be3f30557962c998bed3ba9baf0f556d3322ece7aa27ff7cc77527f40ff87687881707b32dca92c28adef613eb71c5c556fa424ece \ No newline at end of file