diff --git a/Tools/idle/TreeWidget.py b/Tools/idle/TreeWidget.py index 21898ed8b21..bb348bf69ae 100644 --- a/Tools/idle/TreeWidget.py +++ b/Tools/idle/TreeWidget.py @@ -64,6 +64,12 @@ def __init__(self, canvas, parent, item): self.x = self.y = None self.iconimages = {} # cache of PhotoImage instances for icons + def destroy(self): + for c in self.children[:]: + self.children.remove(c) + c.destroy() + self.parent = None + def geticonimage(self, name): try: return self.iconimages[name]