June 2000
Intermediate to advanced
556 pages
8h 45m
English
Building xTree objects programmatically is useful for testing but not much fun. What we need is an algorithm that will read PYX format and create an xTree from it. This algorithm works by keeping track of the current position in the tree as the tree is built from PYX events. A variable known as PasteDown keeps track of the direction in which new nodes should be appended to the tree, that is, beneath the current node (PasteDown == 1) or to the right of the current node (PasteDown == 0).
CD-ROM reference=9017.txt def PYX2xTree(self,f): # Use a stream of PYX to create a tree structure. # Create a temporary root node. self.RootNode = xElement("TEMP") # Set the current position to the root node. self.CurPos = self.RootNode ...Read now
Unlock full access