Issue 1494750: BaseWidget.destroy updates master's childern too early (original) (raw)

In BaseWidget.destroy(), it removes self from its master's dict of children before it calls the Tcl destroy on the widget. If the widget has a destroy callback (like Togl, the Tk OpenGL widget), then nametowidget throws an exception when given the widget's name even though the Python widget still exists. Just reordering the code, so that the Tcl destroy happens before the updating of the master's dict of children, fixes the problem.

The bug is present in earlier versions of Tkinter too.