]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add destroy() method to recursively destroy a tree.
authorGuido van Rossum <guido@python.org>
Fri, 25 Jun 1999 17:07:57 +0000 (17:07 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 25 Jun 1999 17:07:57 +0000 (17:07 +0000)
Tools/idle/TreeWidget.py

index 21898ed8b21ddc5be59ed983df099124523dbc2d..bb348bf69ae57f7bff5f982f8aec38dcef4e7fab 100644 (file)
@@ -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]