Advertisement
TheSafeSword

clock

Mar 30th, 2020
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import time
  2. import datetime
  3. import turtle
  4. n =0
  5. now = datetime.datetime.today()
  6. now =str(now)
  7. print(now)
  8. length = len(now)
  9. seconds = now[length-9:length-7]
  10. seconds = int(seconds)
  11. minutes = now[length-12:length-10]
  12. minutes = int(minutes)
  13. hours = now [length-15:length-13]
  14. hours = int(hours)
  15. from turtle import *
  16. setup()
  17. t1 = Turtle()
  18.  
  19.  
  20. while True:
  21. t1.penup()
  22. t1.goto(-150,0)
  23. t1.pendown()
  24. t1.clear()
  25. t1.write(str(hours).zfill(2)+":"+str(minutes).zfill(2)+":"+str(seconds).zfill(2), font = ("arial",50))
  26. seconds = seconds +1
  27. n += 1
  28. time.sleep(1)
  29. if n % 30 == 0:
  30. now = datetime.datetime.today()
  31. now =str(now)
  32. print(now)
  33. length = len(now)
  34. seconds = now[length-9:length-7]
  35. seconds = int(seconds)
  36.  
  37. if seconds == 60:
  38. seconds = 0
  39. minutes = minutes + 1
  40. if minutes == 60:
  41. minutes = 0
  42. hours = hours + 1
  43. if hours == 24:
  44. hours = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement