Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import tkinter as tk
  2. from tkinter import *
  3. import time
  4. import datetime
  5.  
  6. root = Tk()
  7. root.attributes("-fullscreen", True)
  8.  
  9. time1 = 0
  10. clock = Label(root, font=('helvetica', 180, 'bold'), bg='black', fg='white')
  11. clock.pack(fill=BOTH, expand=1)
  12.  
  13. cronometro = Label(root, font=('helvetica', 140, 'bold'), bg='black', fg='white')
  14. cronometro.pack(fill=BOTH, expand=1)
  15.  
  16.  
  17. def tick():
  18. global time1
  19. # Pegar horario do PC
  20. time2 = time.strftime('%H:%M:%S')
  21. # Se o tempo mudar, atualizar
  22. if time2 != time1:
  23. time1 = time2
  24. clock.config(text=time2)
  25. root.after(50, tick)
  26. tick()
  27.  
  28. def countdown(count):
  29. cronometro['text'] = count
  30.  
  31. if count > 0:
  32. root.after(1000, countdown, count-1)
  33.  
  34. countdown(70)
  35.  
  36. root.mainloop( )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement