[Tutor] setting a timer

Matthew Ngaha chigga101 at gmail.com
Wed Sep 12 19:56:51 CEST 2012


i have a way to set a timer for creating new objects copied from a
book but as i have started my next exercise in a very different way, i
want to avoid that math method/formula as it will cause me to
rearrange some classes totally...

i tried a simple method but its not working. any ideas? heres my code,
ill leave out the irrelevant code.

class Game(object):
    interval = 0

    def play(self):
        Game.interval = 40
        while Game.interval > 0:
                    self.count_down()

    def count_down(self):
        Game.interval -= 1

so the play() method gives interval a value of 40. the while loop
should reduce interval by 1 everytime it calls the count_down()
method. The problem is this is happening instantly. i've even put the
Game.interval value as high as 50000 and it reaches 0 instantly.


More information about the Tutor mailing list