From 30455f305047888f7e1b9a2fb4b2fb1c07cc6cda Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 25 Jun 1999 17:07:57 +0000 Subject: Add destroy() method to recursively destroy a tree. --- Tools/idle/TreeWidget.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tools/idle/TreeWidget.py b/Tools/idle/TreeWidget.py index 21898ed..bb348bf 100644 --- a/Tools/idle/TreeWidget.py +++ b/Tools/idle/TreeWidget.py @@ -64,6 +64,12 @@ class TreeNode: 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] -- cgit v0.12