best way to create a timer/alarm
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Fri Jun 13 03:36:17 EDT 2008
En Fri, 13 Jun 2008 02:42:53 -0300, Alexnb <alexnbryan at gmail.com> escribió:
> 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.
Actually it *is* very important - such things are done in very different
ways on different GUI libraries.
> 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.
Doing so makes your application irresponsive (frozen) until the time
elapses.
Use the "after" method; see <http://effbot.org/tkinterbook/widget.htm>
--
Gabriel Genellina
More information about the Python-list
mailing list