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()
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.