update tkinter window
Roger
morris_r at 4j.lane.edu
Thu Nov 14 16:59:41 EST 2002
I've been messing with tkinter a little.
I was trying to just come up with a window that would show the current
time.
stealing some code from examples, I came up with:
#!/usr/bin/python
from time import localtime,strftime
from Tkinter import *
eugtime=""
class myclock(Frame):
def update_stats(self):
eugtime=strftime("%H:%M:%S",localtime())
self.entry=Entry()
self.entry.pack()
self.contents=StringVar()
self.contents.set(eugtime)
self.entry["textvariable"]=self.contents
self.after(1000,self.update_stats)
def __init__(self,msecs=1000):
Frame.__init__(self)
self.msecs=msecs
self.pack()
self.after(1000,self.update_stats)
myclock(msecs=1000).mainloop()
------------------------------------------------------------
the problem is the window keeps adding a new time making the window ever
increasing in size.
How do I update the window so the contents (the time) get updated rather
than just display the new time?
Thanks
--
Roger
morris_r at 4j.lane.edu
More information about the Python-list
mailing list