Add destroy() method to recursively destroy a tree.

This commit is contained in:
Guido van Rossum 1999-06-25 17:07:57 +00:00
parent fed9b914b5
commit 30455f3050
1 changed files with 6 additions and 0 deletions

View 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]