Thanks Paul, Thanks for the file. I'm very new at this stuff, and now with your file I'm getting: [andres@localhost andres]$ python timer_window.py Traceback (most recent call last): File "timer_window.py", line 2, in ? from Tkinter import * ImportError: No module named Tkinter I guess there's something wrong with my tcl/tk installation. I'll check that and report back. Cheers, Andres Paul Winkler wrote: > On Wed, Oct 20, 2004 at 11:02:19AM -0400, Andres Cabrera wrote: > >>Hi, >>I'm trying it out and get: >>[andres@localhost andres]$ ./counter.sh >> File "./counter.sh", line 10 >> self.widget.pack() >> ^ >>SyntaxError: invalid syntax >>I'm with python 2.2, would I need 2.3? > > > No, it's an indentation error, not sure if that happened in our client(s) > or Dave's cut-paste or what. Try the attached. > > > > ------------------------------------------------------------------------ > > #! /usr/bin/env python > from Tkinter import * > from time import * > > class clock: > def __init__(self,master): > self.starttime=0 > self.widget=Button(master, text="0:0", > font=("Courier",50,"bold"), > relief=FLAT,command=self.reset) > self.widget.pack() > > def idle(self): > thistime = int(time()-self.starttime) > self.widget.config(text=str(thistime/60)+":"+str(thistime%60)) > self.widget.after(1000, self.idle) > > def reset(self): > if not self.starttime: > self.widget.after_idle(self.idle) > self.starttime=time() > > win = Tk() > win.title("ticktock") > slider = clock(win) > win.mainloop()