| PyGTK Tutorial | ||
|---|---|---|
| <<< Previous | Chapter 12. CTree Widget | Next >>> |
node = ctree.insert_node(parent, sibling, text, spacing, pixmap_closed, mask_closed, pixmap_opened, mask_opened, is_leaf, expanded) |
This method looks a little daunting, but
that is merely due to the power of the CTree widget. Not all of the parameters
above are required. The short version is:
node = ctree.insert_node(parent, sibling, text) |
The CTree widget allows you to specify pixmaps to display in each node. For branch nodes, you can specify different pixmaps for when the branch is collapsed or expanded. This gives a nice visual feedback to the user, but it is optional so you don't have to specify pixmaps.
Lets have a quick look at all of the parameters:
parent - the parent node of the one we are inserting. May be None for a root-level (i.e. initial) node.
sibling - a sibling of the node we are inserting. May be None if there are no siblings.
text - the textual contents of each column in the tree for this node. This array must have an entry for each column, even if it is an empty string.
spacing - specifies the padding between the nodes pixmap and text elements, if a pixmap is provided. (default 5)
pixmap_closed - a pixmap to display for a collapsed branch node and for a leaf node. (default None)
mask_closed - a bitmap mask for the above pixmap. (default None)
pixmap_opened - a pixmap to display for an expanded branch node. (default None)
mask_opened - a bitmap mask for the above pixmap. (default None)
is_leaf - indicates whether this is a leaf or branch node. (default TRUE)
expanded - indicates whether a branch node is initially expanded or collapsed. (default FALSE)
To remove a node for a CTree, the following
method is provided:
ctree.remove_node(node) |
As you can see, you merely need to specify a CTree and the node to remove.
| <<< Previous | Home | Next >>> |
| CTree Widget | Up | Setting CTree Attributes |