Message52114
I have often wanted a timer in Python with the same functions as Javas Timer (http://java.sun.com/javase/6/docs/api/java/util/Timer.html). I want it repeating instead of being just a one-shot thing like Pythons Timer class.
Here is a patch that adds such a class to the threading module. You then use it like this:
import threading
def hello():
print "Hi there!"
t = threading.PeriodicTimer(5, hello)
t.start() # "Hi there!" will be printed every five seconds.
The use cases for this class is things like updating canvases, updating simulations and polling stuff. I can provide documentation and unit test patches if this class is deemed worthy.
|
|
Date |
User |
Action |
Args |
2007-08-23 15:57:22 | admin | link | issue1676820 messages |
2007-08-23 15:57:22 | admin | create | |
|