RhetTbull / guitk

Python GUI Toolkit for Tk (guitk): simplify the layout and construction of tkinter graphical user interfaces in python using a declarative syntax.
MIT License
18 stars 1 forks source link

Add timer events #2

Closed RhetTbull closed 3 years ago

RhetTbull commented 3 years ago

Need some way to have virtual events that fire after specified time, for example, to join a long running background thread to check progress. Tkinter’s after and event_generate methods should make this easy.

For example, perhaps a Window.bind_timer_event(delay, event_name, repeat=False) -> timer_id:

This would fire event_name virtual event after delay (ms) which could be handled by handle_event. If repeat = True, the virtual event would fire every delay ms until canceled. Returns timer_id which can be used to cancel the event with Window.cancel_timer_event(timer_id)