Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. from tkinter import *
  2. import math
  3. from datetime import datetime
  4. datetime.now().strftime('%Y-%m-%d %H:%M:%S')
  5. a = int(datetime.now().strftime('%M'))
  6. b = int( datetime.now().strftime('%H'))
  7. c = int(datetime.now().strftime('%S'))
  8.  
  9.  
  10.  
  11. a1 = a*30 - 90
  12. b1 = b*6 - 90
  13. c1 = c*6 - 90
  14. r=268
  15.  
  16. master = Tk()
  17. winW = 1000
  18. winH = 1000
  19.  
  20. w = Canvas(master, width=winW, height=winH)
  21. w.pack()
  22.  
  23. w.create_oval(100,100,700,700,fill="gray")
  24. w.create_oval(382,382,418,418,fill="WHITE")
  25.  
  26. for k in range(1,13):
  27. k1 = math.radians(k*30-90)
  28. w.create_text(400 + r*math.cos(k1), 400 + r*math.sin(k1),text= k,font=("Courier", 44))
  29.  
  30.  
  31. def cat():
  32. global h, b1
  33. w.delete(h)
  34. b = int( datetime.now().strftime('%H'))
  35. b1 = b*30 - 90
  36. k2 = math.radians(b1)
  37. h = w.create_line(400,400,400 + (r-100)*math.cos(k2), 400 + (r-100)*math.sin(k2),width=10)
  38.  
  39. w.after(100, cat)
  40.  
  41. def cat1():
  42. global m, a1 ,a
  43. w.delete(m)
  44. a= int(datetime.now().strftime('%M'))
  45. a1 = a*6 - 90
  46. k3 = math.radians(a1)
  47. m= w.create_line(400,400,400 + (r-40)*math.cos(k3), 400 + (r-40)*math.sin(k3),width=15)
  48.  
  49.  
  50. w.after(100, cat1)
  51. def cat3():
  52. global s, c1
  53. w.delete(s)
  54. c = int(datetime.now().strftime('%S'))
  55. c1 = c*6 - 90
  56. k4 = math.radians(c1)
  57. s = w.create_line(400,400,400 + (r-40)*math.cos(k4), 400 + (r-40)*math.sin(k4),width=10)
  58.  
  59. w.after(100, cat3)
  60.  
  61.  
  62.  
  63. k2 = math.radians(b1)
  64. k3 = math.radians(a1)
  65. k4 = math.radians(c1)
  66.  
  67.  
  68. h = w.create_line(400,400,400 + (r-40)*math.cos(k2), 400 + (r-40)*math.sin(k2),width=10)
  69. m= w.create_line(400,400,400 + (r-100)*math.cos(k3), 400 + (r-100)*math.sin(k3),width=15)
  70. s = w.create_line(400,400,400 + (r-10)*math.cos(k4), 400 + (r-10)*math.sin(k4),width=10)
  71.  
  72. cat()
  73. cat1()
  74. cat3()
  75.  
  76. master.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement