Addition of Window.timer_get_active_timers to get a list of the currently active timers for a window. Added to the demo program.
This commit is contained in:
parent
747ff76d08
commit
4180f59c4c
2 changed files with 39 additions and 9 deletions
|
@ -4,7 +4,7 @@ import PySimpleGUI as sg
|
|||
Demo Program - Window Timers
|
||||
|
||||
Uses the PySimpleGUI Window Timers to generate single or periodic timer events.
|
||||
Requires version 4.60.4.131 or greater of PySimpleGUI.
|
||||
Requires version 4.60.4.133 or greater of PySimpleGUI.
|
||||
|
||||
Copyright 2022 PySimpleGUI
|
||||
"""
|
||||
|
@ -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.B('Stop All')],
|
||||
[sg.T('Timer ID to stop:'), sg.Input(key='-STOP-', s=4), sg.Button('Stop'), sg.B('Stop All'), sg.B('List Active')],
|
||||
[sg.Output(size=(90, 10))],
|
||||
[sg.Button('Does nothing'), sg.Button('Exit')] ]
|
||||
|
||||
|
@ -38,7 +38,9 @@ def main():
|
|||
window.timer_stop(id)
|
||||
elif event == 'Stop All':
|
||||
window.timer_stop_all()
|
||||
|
||||
elif event == 'List Active':
|
||||
sg.cprint('Active Timers:', end='', c='white on red')
|
||||
sg.cprint(window.timer_get_active_timers(), c='white on green')
|
||||
window.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue