tk.after troubles

Steven Miale (smiale@cs.indiana.edu)
Tue, 7 Jun 1994 20:43:37 -0500

This is a small Tkinter program that creates an empty Tk window, then uses
'after' to call the function 'everytime' every 20 milliseconds.

After about 30 seconds or so, I get this message:

tkerror failed to handle background error.
Original error: too many nested calls to Tcl_Eval (infinite loop?)
Error in tkerror: too many nested calls to Tcl_Eval (infinite loop?)

The Python process has also grown from about 1.5M to 5M. Commenting out the
'root1.mainloop()' in everytime results in the program exiting. Having
widgets does *not* solve the problem - I'm guessing it is a bug with the
after interface.

-- cut here --
from Tkinter import *

root1 = Tk()
tk1 = root1.tk

def everytime():
root1.after(20, everytime)
root1.mainloop()

def main():
root1.after(20, everytime)
root1.mainloop()

main()