Inherits from
- Widget: enthought.pyface.widget.Widget
Attributes
- control_right_clicked
A right-click occurred on the control (not a node!).
control_right_clicked = Event
- filters
The tree's filters (empty if no filtering is required).
filters = List(Filter)
- key_pressed
A key was pressed while the tree has focus.
key_pressed = Event(KeyPressedEvent)
- lines_mode
Mode for lines connecting tree nodes which emphasize hierarchy: 'appearance' - only on when lines look good, 'on' - always on, 'off' - always off NOTE: on and off are ignored in favor of show_lines for now
lines_mode = Enum('appearance', 'on', 'off')
- model
The model that provides the data for the tree.
model = Instance(TreeModel, ())
- node_activated
A node has been activated (ie. double-clicked).
node_activated = Event
- node_begin_drag
A drag operation was started on a node.
node_begin_drag = Event
- node_collapsed
A (non-leaf) node has been collapsed.
node_collapsed = Event
- node_expanded
A (non-leaf) node has been expanded.
node_expanded = Event
- node_left_clicked
A left-click occurred on a node.
Tuple(node, point).
node_left_clicked = Event
- node_right_clicked
A right-click occurred on a node.
Tuple(node, point)
node_right_clicked = Event
- root
The root of the tree (this is for convenience, it just delegates to the tree's model).
root = Property(Any)
- selection
The objects currently selected in the tree.
selection = List
- selection_mode
Selection mode.
selection_mode = Enum('single', 'extended')
- show_images
Should an image be shown for each node?
show_images = Bool(True)
- show_lines
Should lines be drawn between levels in the tree.
show_lines = Bool(True)
- show_root
Should the root of the tree be shown?
show_root = Bool(True)
- sorter
The tree's sorter (None if no sorting is required).
sorter = Instance(Sorter)
- STYLE
The default tree style.
STYLE = (wx.TR_EDIT_LABELS | wx.TR_HAS_BUTTONS | wx.CLIP_CHILDREN)
Method summary
- __init__(self, parent, image_size = (16, 16), **traits)
- collapse(self, node)
- edit_label(self, node, callback = None)
- expand(self, node)
- expand_all(self)
- get_parent(self, node)
- is_expanded(self, node)
- is_selected(self, node)
- on_drag_over(self, x, y, obj, default_drag_result)
- on_drop(self, x, y, obj, default_drag_result)
- on_dropped(self)
- refresh(self, node)
- select(self, node)
- set_selection(self, list)
Methods
- __init__(self, parent, image_size = (16, 16), **traits)
Creates a new tree.
'parent' is the toolkit-specific control that is the tree's parent.
'image_size' is a tuple in the form (int width, int height) that specifies the size of the images (if required) displayed in the tree.
- collapse(self, node)
Collapses the specified node.
- edit_label(self, node, callback = None)
Edits the label of the specified node.
If a callback is specified it will be called when the label edit completes WHETHER OR NOT the label was actually changed.
The callback must take exactly 3 arguments:- (tree, node, label)
- expand(self, node)
Expands the specified node.
- expand_all(self)
Expands every node in the tree.
- get_parent(self, node)
Returns the parent of a node.
This will only work iff the node has been displayed in the tree. If it hasn't then None is returned.
- is_expanded(self, node)
Returns True if the node is expanded, otherwise False.
- is_selected(self, node)
Returns True if the node is selected, otherwise False.
- on_drag_over(self, x, y, obj, default_drag_result)
Called when a node is dragged over the tree.
- on_drop(self, x, y, obj, default_drag_result)
Called when a node is dropped on the tree.
- on_dropped(self)
Callback invoked when a drag/drop operation has completed.
- refresh(self, node)
Refresh the tree starting from the specified node.
Call this when the structure of the content has changed DRAMATICALLY.
- select(self, node)
Selects the specified node.
- set_selection(self, list)
Selects the specified list of nodes.