Here's my timer:
while True:
if count > 1800:
break
time.sleep(1)
count += 1
Or should I just do: time.sleep(1800)?
A little context would be helpful. If you are writing a standalone app
that just needs to wait 30 minutes, then do something, use time.sleep().
If the program needs to be able to do something else at the same time as
the timer is running, you will have to put the sleep() call in a
separate thread. threading.Timer will do this for you, see this recipe
for an example of its use:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440476
If you are running in a GUI app, the GUI toolkit may have a timer you
can use, for example in Tkinter widgets have an after() method that
schedules a callback for a future time; wxPython has wx.FutureCall.
http://www.pythonware.com/library/tkinter/introduction/x9507-alarm-handlers-and-other.htm
http://www.wxpython.org/docs/api/wx.FutureCall-class.html
Kent
--
There are 10 different types of people in the world.
Those who understand binary and those who don't.
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor