On my quest to learn Python and tkinter, I have found sometimes a pattern like this, which I have just extracted from a book on tkinter:
I understand that this is a way to repeat some steps in a recursive way, after a specified time, and I have even used before this kind of pattern in a project. But I wonder if there a limit to the number of times this recursive calls can be made. I mean, probably Python is keeping some kind of reference about which function or method called which. So, maybe in a few hundred or a few thousand cycles we could hit that limit.
Is there such a limit we should take into consideration in cases like this? If so, what would be considered a good practice? How can we know how many recursive calls will be allowed and how to avoid the app becoming unresponsive or returning some error?
Using after this way isn't recursion. You're simply pushing jobs onto a queue. There is no limit because you're only adding one item to the queue for each item that is pulled off of the queue. Assuming this is the only place you do this, and you only start it once, the queue never grows bigger than one.