===========================
********Tkinter Digital Clock********
____________________________________
1. # use Tkinter to show a digital clock
2. # tested with Python24 vegaseat 10sep2016
3.
4. from Tkinter import *
5. import time
6.
7. root = Tk ()
8. time1 = ''
9. clock = Label (root, font =('times' , 20 , 'bold'), bg= 'green' )
0. clock.pack( fill=BOTH, expand= 1)
1.
2. def tick():
3. global time1
4. # get the current local time from the PC
5. time2 = time. strftime
('%H:%M:%S' )
6. # if time string has changed, update it
7. if time2 != time1 :
8. time1 = time2
9. clock.config
(text=time2 )
0. # calls itself every 200 milliseconds
1. # to update the time display as needed
2. # could use >200 ms, but display gets jerky
3. clock.after (200 , tick)
4.
5. tick()
6. root.mainloop( )
____________________________________
Thanks For Visiting.....
===========================
Monday, February 27, 2017
Tkinter Digital Clock (Python)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment