Recursive method
Ralph Gauges
ralph.gauges at eml.villa-bosch.de
Tue Jul 13 10:13:47 EDT 1999
More information about the Python-list mailing list
Tue Jul 13 10:13:47 EDT 1999
- Previous message (by thread): Recursive method
- Next message (by thread): Recursive method
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello,
I am trying to generate a JTree (in JPython) out of some
Data I have. The data I have is structured in classes which
have a list of classes that have a list of classes and so
on. Now I want to call the makenodes method with the top
level class and have the function follow the tree
recursively (see code below). Unfortunately all I get is a
'NameError' for makenodes, when the function is supposed to
call itself. This seems to be a problem with the namespace,
but I have no idea, how to solve this. Any help would be
appreciated.
Thanks a lot in advance
Ralph
def makeTree():
.
.
.
def makenodes(C):
N=javax.swing.tree.DefaultMutableTreeNode(C.Name)
Children=C.getChildren()
for Child in Children:
N.add(makenodes(Child))
return N
for Class in M.Classes:
ClassNode.add(makenodes(Class))
.
.
.
- Previous message (by thread): Recursive method
- Next message (by thread): Recursive method
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list