[Tutor] clocks?

Isaac Hall hall@ouhep1.nhn.ou.edu
Tue Dec 3 12:02:08 2002


hi list!

This question is not all that important, so if you don't know the answer 
right off the top of your head, don't feel like you have to go searching 
for it.  In Tkinter, at the top(or bottom) of some frame, I would like to 
place somewhat of a clock, not your ordinary clock, but one that tells you 
how many seconds have passed since some event happened.  I make this as a 
label....

For understandings sake, here is the class I define to hold this thing.

class notifier(Label):
    def __init__(self,parent):
        self.text=StringVar()
        self.text.set('no messages recieved')
        Label.__init__(self,parent, bg='white',textvariable=self.text)
        self.count=0
        self.end=1
    def start_count(self):
        self.count=1
        messageArrivalTime=time.time()
        self.counting()
    def counting(self):
        if not self.count:
            diff=int(time.time()-messageArrivalTime)
            self.text.set('message recieved '+str(diff)+' seconds ago')
            self.after(1000, self.counting)
        else:
            self.text.set('no messages recieved')
    def stop_count(self):
        self.count=0

My problems arise when I try to put this into a frame, pack it, then call 
the start_count() method.  When I do this, nothing appears on the screen!
why?

Ike
--