'tkinter .after() invalid command name

I work on Python 3.10.2 and I just start to work with tkinter and I always have a problem with .after() method. For example with this program :

import tkinter as tk

def initialisation(compteur) :
    compteur=compteur+1
    print(compteur)
    root.after(2000,initialisation, compteur)

root=tk.Tk()    
initialisation(0)
root.mainloop()

I have this error :

1

invalid command name "1720125185344initialisation"
    while executing
"1720125185344initialisation"
    ("after" script)
2
3

It works but I still have this error 1 time. I have looked for solutions but I don't understand. Thank you in advance for your help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source