Update, clock works !!!

This commit is contained in:
Dennis Eckerskorn 2024-12-03 19:23:10 +01:00
parent 5fef37dc09
commit ebbb42911a
2 changed files with 8 additions and 9 deletions

View File

@ -167,17 +167,16 @@ class CenteredWindow(ctk.CTk):
threading.Thread(target=self.update_emails, daemon=True).start() threading.Thread(target=self.update_emails, daemon=True).start()
def update_time(self): def update_time(self):
while True: # Obtén la hora y la fecha actual
# Obtén la hora y la fecha actual current_time = datetime.datetime.now().strftime('%H:%M:%S')
current_time = datetime.now().strftime('%H:%M:%S') current_date = datetime.datetime.now().strftime('%d/%m/%Y')
current_date = datetime.now().strftime('%d/%m/%Y')
# Actualiza las etiquetas # Actualiza las etiquetas en el hilo principal
self.info_labels["hora"].configure(text=f"Hora: {current_time}") self.info_labels["hora"].configure(text=f"Hora: {current_time}")
self.info_labels["fecha"].configure(text=f"Fecha: {current_date}") self.info_labels["fecha"].configure(text=f"Fecha: {current_date}")
# Programa la próxima actualización en 1000 ms (1 segundo) # Programa la próxima ejecución en 1000 ms (1 segundo)
time.sleep(1) self.after(1000, self.update_time)