Skip to content

Instantly share code, notes, and snippets.

@ramalho
Last active April 17, 2022 22:21
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ramalho/6417872 to your computer and use it in GitHub Desktop.
Save ramalho/6417872 to your computer and use it in GitHub Desktop.
Um relógio bem simples feito em Python com Tkinter. Vídeo de demonstração: http://www.youtube.com/watch?v=xCiPshN9nOs
#!/usr/bin/env python3
import tkinter
from time import strftime
def tic():
rel['text'] = strftime('%H:%M:%S')
def tac():
tic()
rel.after(1000, tac)
rel = tkinter.Label()
rel['font'] = 'Helvetica 120 bold'
rel.pack()
tac()
# para que funcione como um script, temos que chamar mainloop,
# senão o programa termina imediatamente após a chamada tac()
rel.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment