[Tutor] python timers

michael scott jigenbakuda at yahoo.com
Thu Apr 21 06:38:19 CEST 2011


Hello how do you do.

Today's question has to do with the time module. I want to add a timer to my 
gui. 


 
As I was messing around with it I found a way to measure time... but I'm 
positive there is a more elegant way to deal with this than what I've thrown 
together. 


def thing():
    start = time.time()
    while 1:
        now = time.time()
        if now == start + 10.0:
            print "times up"

How are timers usually implemented?  By the way, I'm not really asking as much 
about the how (because I could throw something together that will serve my 
purpose), I'm asking more about conventions, like is there a standard way people 
implement timers, like does python come with one built in? Does every programmer 
who wants a timer write a different one?



----
What is it about you... that intrigues me so?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110420/63576ea9/attachment.html>


More information about the Tutor mailing list