Little change
This commit is contained in:
parent
b3e6827191
commit
5fef37dc09
Binary file not shown.
|
@ -5,6 +5,7 @@ import os
|
||||||
import threading
|
import threading
|
||||||
import random
|
import random
|
||||||
import datetime
|
import datetime
|
||||||
|
import time
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
class CenteredWindow(ctk.CTk):
|
class CenteredWindow(ctk.CTk):
|
||||||
|
@ -157,7 +158,7 @@ class CenteredWindow(ctk.CTk):
|
||||||
|
|
||||||
def start_threads(self):
|
def start_threads(self):
|
||||||
# Hilo para actualizar el reloj
|
# Hilo para actualizar el reloj
|
||||||
self.update_time()
|
threading.Thread(target=self.update_time, daemon=True).start()
|
||||||
|
|
||||||
# Hilo para actualizar la temperatura
|
# Hilo para actualizar la temperatura
|
||||||
threading.Thread(target=self.update_temperature, daemon=True).start()
|
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()
|
threading.Thread(target=self.update_emails, daemon=True).start()
|
||||||
|
|
||||||
def update_time(self):
|
def update_time(self):
|
||||||
# Obtén la hora y la fecha actual
|
while True:
|
||||||
current_time = datetime.now().strftime('%H:%M:%S')
|
# Obtén la hora y la fecha actual
|
||||||
current_date = datetime.now().strftime('%d/%m/%Y')
|
current_time = datetime.now().strftime('%H:%M:%S')
|
||||||
|
current_date = datetime.now().strftime('%d/%m/%Y')
|
||||||
|
|
||||||
# Actualiza las etiquetas
|
# Actualiza las etiquetas
|
||||||
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 actualización en 1000 ms (1 segundo)
|
||||||
self.after(1000, self.update_time)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue