On Jun 12, 11:42 pm, Alexnb <[EMAIL PROTECTED]> wrote: > I am wondering what is the best way to create a timer, like an alarm, once it > reaches a time, it triggers an event. I have a way of doing this but it > seems like it isn't good at all. If it helps at all I am using a Tkinter, > but that probably doesn't mean much. The way I was doing it was using a > while loop, and just saying while current time is not = to trigger time, do > nothing, and when it is, do event.
Tkinter makes a big difference here. Like most (all?) event loops, it provides a way to call a function after a specified amount of time. Here's two pages I found: http://mail.python.org/pipermail/python-list/2001-August/101233.html http://www.astro.washington.edu/owen/TkinterSummary.html#After Note that it only fires once. If you want it to fire again you're callback will have to setup another timer. -- http://mail.python.org/mailman/listinfo/python-list