Tkinter: Exception RuntimeError: 'maximum recursion depth exceeded'

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Wed Oct 13 12:31:57 CEST 2010

In message <i93mgn$i39$1 at>, Olaf Dietrich wrote:

> If I replace update() by update_idletasks(), the problem
> disappears, but unfortunately, considerably fewer events
> are recorded on the canvas (when connecting the pixels with
> lines, the lines become much longer with update_idletasks()
> than with update()). If I remove both update() and
> update_idletasks(), things work similarly as with
> update_idletasks() (the display is only marginally slower
> than with update_idletasks()).

How about simply avoiding recursive updates.

Add this line to your __init__ method:

    self.reentered = False

In your viewdata method, put this at the start:

    save_reentered = self.reentered
    self.reentered = True

and this at the end:

    self.reentered = save_reentered

while the update call becomes conditional on not being reentered:

    if not save_reentered:

Of course, this is all a total guess, I really know nothing about TKinter. 

More information about the Python-list mailing list