summaryrefslogtreecommitdiffstats
path: root/Tools/idle
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-06-25 17:07:57 (GMT)
committerGuido van Rossum <guido@python.org>1999-06-25 17:07:57 (GMT)
commit30455f305047888f7e1b9a2fb4b2fb1c07cc6cda (patch)
tree75335271aadb9d9ab158005442758a66bfc9070e /Tools/idle
parentfed9b914b5469ba36c30c0e6ab9cde441c2431a9 (diff)
downloadcpython-30455f305047888f7e1b9a2fb4b2fb1c07cc6cda.zip
cpython-30455f305047888f7e1b9a2fb4b2fb1c07cc6cda.tar.gz
cpython-30455f305047888f7e1b9a2fb4b2fb1c07cc6cda.tar.bz2
Add destroy() method to recursively destroy a tree.
Diffstat (limited to 'Tools/idle')
-rw-r--r--Tools/idle/TreeWidget.py6
1 files changed, 6 insertions, 0 deletions
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]