Issue 1304895: Strobe Timer for guis (original) (raw)

Issue1304895

Created on 2005-09-26 14:51 by bdrosen, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
timers.c bdrosen,2005-09-26 14:51 implementation of module
Messages (3)
msg48795 - (view) Author: Brett Rosen (bdrosen) Date: 2005-09-26 14:51
Often when doing gui work it is useful to queue up a task to run at some later time - either once or periodically. Although you can use the thread support to do this, it is problematic because: 1 one because if the work being done is gui related, it often needs to be done in the same thread which owns the gui 2 it is easier to not need to code using threads if you don't need to 3 having multiple threads executing at once doesn't scale so well, especially when you have lots of idle time in a gui app. I created this module to get around this problem. In you gui, you would add _timers.AppServiceTimers to your onIdle method (or whatever method get called for idle processing) Then to register an event to be run you would do: import _timers a = _timers.StrobeTimer() a.Interval(500) def MyStrobe(self): print "I am called every 500 ms", self a.Strobe = MyStrobe a.StartTimer() # do some work a.StopTimer()
msg48796 - (view) Author: Björn Lindqvist (sonderblade) Date: 2007-03-08 22:03
Thank you for your contribution! However, most GUI libraries already come with their own timer implementations. Also, there is no gain in writing it in C, since the execution speed of the timer class is not important. Additionally, the coding and naming style in the code is inconsistent and not in compliance with PEP7. For these reasons, I think the patch should not be accepted.
msg48797 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-10 16:02
This is something that should ship with GUI toolkits, not in Python's stdlib. Please submit this patch to whichever GUI toolkit you favor.
History
Date User Action Args
2022-04-11 14:56:13 admin set github: 42417
2005-09-26 14:51:52 bdrosen create