[Tutor] Time Variable

Britt Green britt_green@hotmail.com
Sun, 08 Jul 2001 14:24:52 -0700


What I'm trying to do is to get a variable that gets updated once every 
second to hold the current time. However, when I write my code, the variable 
gets initialized once, and never again. Can someone point out the error in 
my code?

import time

class GameTime:
    def __init__(self):
        print "Class GameTime initiated."

    def updateTime(self, theTime):
        while 1:
            self.theTime = time.ctime(time.time())
            print theTime
            time.sleep( 1 )

myTime = GameTime()
myTime.updateTime( time.ctime(time.time()) )
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com