Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import math
- from datetime import datetime
- datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- a = int(datetime.now().strftime('%M'))
- b = int( datetime.now().strftime('%H'))
- c = int(datetime.now().strftime('%S'))
- a1 = a*30 - 90
- b1 = b*6 - 90
- c1 = c*6 - 90
- r=268
- master = Tk()
- winW = 1000
- winH = 1000
- w = Canvas(master, width=winW, height=winH)
- w.pack()
- w.create_oval(100,100,700,700,fill="gray")
- w.create_oval(382,382,418,418,fill="WHITE")
- for k in range(1,13):
- k1 = math.radians(k*30-90)
- w.create_text(400 + r*math.cos(k1), 400 + r*math.sin(k1),text= k,font=("Courier", 44))
- def cat():
- global h, b1
- w.delete(h)
- b = int( datetime.now().strftime('%H'))
- b1 = b*30 - 90
- k2 = math.radians(b1)
- h = w.create_line(400,400,400 + (r-100)*math.cos(k2), 400 + (r-100)*math.sin(k2),width=10)
- w.after(100, cat)
- def cat1():
- global m, a1 ,a
- w.delete(m)
- a= int(datetime.now().strftime('%M'))
- a1 = a*6 - 90
- k3 = math.radians(a1)
- m= w.create_line(400,400,400 + (r-40)*math.cos(k3), 400 + (r-40)*math.sin(k3),width=15)
- w.after(100, cat1)
- def cat3():
- global s, c1
- w.delete(s)
- c = int(datetime.now().strftime('%S'))
- c1 = c*6 - 90
- k4 = math.radians(c1)
- s = w.create_line(400,400,400 + (r-40)*math.cos(k4), 400 + (r-40)*math.sin(k4),width=10)
- w.after(100, cat3)
- k2 = math.radians(b1)
- k3 = math.radians(a1)
- k4 = math.radians(c1)
- h = w.create_line(400,400,400 + (r-40)*math.cos(k2), 400 + (r-40)*math.sin(k2),width=10)
- m= w.create_line(400,400,400 + (r-100)*math.cos(k3), 400 + (r-100)*math.sin(k3),width=15)
- s = w.create_line(400,400,400 + (r-10)*math.cos(k4), 400 + (r-10)*math.sin(k4),width=10)
- cat()
- cat1()
- cat3()
- master.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement