This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sonderblade
Recipients
Date 2007-03-08.21:28:21
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.
History
Date User Action Args
2007-08-23 15:57:22adminlinkissue1676820 messages
2007-08-23 15:57:22admincreate