How to create a timer/scheduler in Python?

MrJean1 MrJean1 at gmail.com
Sun Jul 13 05:08:38 CEST 2008


There is a module called sched in the standard Python library

  <http://docs.python.org/lib/module-sched.html>

/Jean Brouwers



John Dann wrote:
> 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
> Python?



More information about the Python-list mailing list