diff --git a/src/ui/__pycache__/centered_window.cpython-312.pyc b/src/ui/__pycache__/centered_window.cpython-312.pyc index 1863594..5dcc6f5 100644 Binary files a/src/ui/__pycache__/centered_window.cpython-312.pyc and b/src/ui/__pycache__/centered_window.cpython-312.pyc differ diff --git a/src/ui/centered_window.py b/src/ui/centered_window.py index 8b1c4e0..7e61f63 100644 --- a/src/ui/centered_window.py +++ b/src/ui/centered_window.py @@ -5,6 +5,7 @@ import os import threading import random import datetime +import time import requests class CenteredWindow(ctk.CTk): @@ -157,7 +158,7 @@ class CenteredWindow(ctk.CTk): def start_threads(self): # Hilo para actualizar el reloj - self.update_time() + threading.Thread(target=self.update_time, daemon=True).start() # Hilo para actualizar la temperatura threading.Thread(target=self.update_temperature, daemon=True).start() @@ -166,16 +167,17 @@ class CenteredWindow(ctk.CTk): threading.Thread(target=self.update_emails, daemon=True).start() def update_time(self): - # Obtén la hora y la fecha actual - current_time = datetime.now().strftime('%H:%M:%S') - current_date = datetime.now().strftime('%d/%m/%Y') + while True: + # Obtén la hora y la fecha actual + current_time = datetime.now().strftime('%H:%M:%S') + current_date = datetime.now().strftime('%d/%m/%Y') - # Actualiza las etiquetas - self.info_labels["hora"].configure(text=f"Hora: {current_time}") - self.info_labels["fecha"].configure(text=f"Fecha: {current_date}") + # Actualiza las etiquetas + self.info_labels["hora"].configure(text=f"Hora: {current_time}") + self.info_labels["fecha"].configure(text=f"Fecha: {current_date}") - # Programa la próxima actualización en 1000 ms (1 segundo) - self.after(1000, self.update_time) + # Programa la próxima actualización en 1000 ms (1 segundo) + time.sleep(1)