How to make Python poll a PYTHON METHOD
James Stroud
jstroud at mbi.ucla.edu
Mon May 7 23:09:39 EDT 2007
johnny wrote:
> Is there a way to call a function on a specified interval(seconds,
> milliseconds) every time, like polling user defined method?
>
> Thanks.
>
A very literal interpretation of your question yields the following very
simple answer:
import time
while True:
time.sleep(some_number_of_seconds)
user_defined_method()
A more sophisticated approach would use threading, for example:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/464959
James
More information about the Python-list
mailing list