The TreeViewColumns in a TreeView can be retrieved singly or as a list using the methods:
treeviewcolumn = treeview.get_column(n) columnlist = treeview.get_columns() |
where n is the index (starting from 0) of the column to retrieve. A column can be removed using the method:
treeview.remove_column(column) |
where column is a TreeViewColumn in treeview.
Rows that have child rows are displayed in the TreeView with an expander arrow (see Figure 14.3, “CellRenderer Data Function”) that the user clicks on to hide or reveal the child row(s). The column that the expander arrow is displayed in can be changed using the method:
treeview.set_expander_column(column) |
where column is a TreeViewColumn in treeview. This method is useful when you want the first column to not indent. For example, Figure 14.7, “Expander Arrow in Second Column” illustrates the expander arrow in the second column:
All the rows displayed in a TreeView can be programmatically expanded or collapsed using the following methods:
treeview.expand_all() treeview.collapse_all() |
These methods are useful if you want to initialize the TreeView display to a known state. Individual rows can be expanded or collapsed using:
treeview.expand_row(path, open_all) treeview.collapse_row(path) |
where path is the tree path to a row in treeview, and if open_all is TRUE all descendant rows of path are expanded; otherwise just the immediate children are expanded.
You can determine if a row is expanded using the method:
is_expanded = treeview.row_expanded(path) |