Subir archivos a "/"
This commit is contained in:
parent
247021823c
commit
dc854fe553
|
|
@ -0,0 +1,23 @@
|
||||||
|
# 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()
|
||||||
Loading…
Reference in New Issue