Tkinter window displaying the time?

G. Willoughby thecalm at NOSPAM.btinternet.com
Fri Aug 24 15:17:22 EDT 2001


How can i display the time (continually updating) in title bar on windows
(WinME), this is the code im using:

from Tkinter import *
from time import *
currentTime=asctime(localtime(time()))
timeZone="GMT: "
hours=strftime("%I",localtime(time()))
minutes=strftime("%M",localtime(time()))
seconds=strftime("%S",localtime(time()))
amPm=" "+strftime("%p",localtime(time()))
seperator=":"
root=Tk()
root.iconify()
root.title(timeZone+hours+seperator+minutes+amPm)
root.mainloop()

I thought of using a while 1: loop and providing a 1 second delay with
sleep(1) to update the title but this don't seem to be working, any ideas???

G. Willoughby





More information about the Python-list mailing list