Tengo este código de python para crear un evento que se ejecuta cada segundo. Y sí funciona, el problema es que no entiendo bien por qué.
Según yo, en le línea de root.after(1000,timeChanged)
está generando una llamada recursiva, pero no hay falla el límite de la recursividad.
La cosa cambia cuando se le agregan paréntesis al final root.after(1000,timeChanged())
. Aquí sí manda error de recursividad.
¿Saben por qué es distinto y por qué es que funciona?
import tkinter as tk
import time
def timeChanged():
date = time.strftime("%H:%M:%S")
timeLabel.configure(text = date)
root.after(1000,timeChanged)
root = tk.Tk()
root.title("Ventana")
root.geometry("400x400")
#timeLabel = tk.Label(root, bg = "orange", textvariable = var, padx = 5, pady = 5, width = 10)
timeLabel = tk.Label(root, bg = "orange", text = "h", padx = 5, pady = 5, width = 10)
timeLabel.pack()
timeChanged()
root.mainloop()
``