# utility_thread.py import datetime import time import threading def update_time(status_label): """Función que actualiza la hora y el día de la semana en un label en un hilo.""" while True: now = datetime.datetime.now() day_of_week = now.strftime("%A") time_str = now.strftime("%H:%M:%S") date_str = now.strftime("%Y-%m-%d") label_text = f"{day_of_week}, {date_str} - {time_str}" # Usamos after para actualizar el widget de Tkinter de forma segura status_label.after(1000, status_label.config, {"text": label_text}) time.sleep(1) def start_time_thread(status_label): """Inicia el hilo del reloj.""" update_thread = threading.Thread(target=update_time, args=(status_label,)) update_thread.daemon = True update_thread.start()