Trees
set root [.pad create rectangle 0 0 50 50 -fill white] set child1 [.pad create rectangle 0 0 50 50 -fill red] set child2 [.pad create rectangle 0 0 50 50 -fill green] set child3 [.pad create rectangle 0 0 50 50 -fill blue] # Create the dynamic tree data nodes .pad tree create $root .pad tree create $child1 .pad tree create $child2 .pad tree create $child3 # Create the tree structure .pad tree addnode $child1 $root .pad tree addnode $child2 $root .pad tree addnode $child3 $root # Layout the tree .pad tree layout $rootThe tree structure can be accessed with the getparent and getchildren commands. These return the ids of the appropriate members of the hierarchy.![]()
.pad tree getparent $child1 => Returns $root .pad tree getchildren $root => Returns a list of child1 child2 child3 .pad tree getchildren $child1 => Returns an empty string
Generated with Harlequin WebMaker