How to create a timer/scheduler in Python?
fetchinson at googlemail.com
Sat Jul 12 18:49:25 CEST 2008
> I need what I'd call (in .Net) a timer, ie I need to run a function eg
> every 2 seconds - it doesn't need to be millisec accurate but it would
> be nice if it wasn't eg every 4 seconds or something.
> Rather surprisingly, Core Python (Chun) doesn't seem to index 'timer'
> or 'scheduler', which leaves me wondering whether this is an aspect of
> Python that isn't perhaps widely used?
> Looking around on the net I can see references to a thread timer, but
> I'm not really looking to start any new threads (I just want part of
> the GUI to update every 2 secs) and don't want to get into that sort
> of complication while still just learning Python.
> Is there really no simple timer/scheduler function available in
You might want to look at scheduler.py from turbogears which is
exactly the tool you describe and luckily is 99.99% independent of
turbogears. I'd think you need to modify 1-2 lines:
Psss, psss, put it down! - http://www.cafepress.com/putitdown
More information about the Python-list