Skip to content

Instantly share code, notes, and snippets.

@MedeirosJoel
Last active July 24, 2022 02:17
Show Gist options
  • Save MedeirosJoel/5d766f2b44a91d8c8417976ee97da50b to your computer and use it in GitHub Desktop.
Save MedeirosJoel/5d766f2b44a91d8c8417976ee97da50b to your computer and use it in GitHub Desktop.
Relogio Grafico com Python Tkinter
#Libs para o uso do aplicativo
from threading import Thread
from time import strftime, localtime, sleep
from tkinter import *
# Cria a função que será usada para atualizar o label l
def atualizaHora():
while True:
l.configure(text=strftime("%H:%M:%S", localtime()))
sleep(1)
#Instancia o "root" e altera atributos
gui = Tk() #Instancia
gui.overrideredirect(False) # Atributo que tira a barra de titulo
gui.attributes('-topmost', True) # Atributo que deixa a janela sempre no topo
gui.update() # Atualiza o root com os novos atributos
# Instancia o label l
l = Label(gui, text="Relogio", font=('Arial', 50))
l.pack()
# Cria e inicia a Thread que vai atualizar o label
thread = Thread(target= atualizaHora)
thread.setDaemon(True)
thread.start()
#Instancia o root
gui.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment