traitsui.editors.tree_editor module

Defines the tree editor factory for all traits user interface toolkits.

class traitsui.editors.tree_editor.ToolkitEditorFactory(*args, **traits)

Bases: traitsui.editor_factory.EditorFactory

Editor factory for tree editors.

activated = Str

The optional extended trait name of the trait that should be assigned a node object when a tree node is activated, by double-clicking or pressing the Enter key when a node has focus (Note: if you want to receive repeated activated events on the same node, make sure the trait is defined as an Event):

alternating_row_colors = Bool(False)

Whether to alternate row colors or not.

auto_open = Int

Number of tree levels (down from the root) that should be automatically opened

click = Str

The optional extended trait name of the trait that should be assigned a node object when a tree node is clicked on (Note: If you want to receive repeated clicks on the same node, make sure the trait is defined as an Event):

column_headers = List(Str)

The column header labels if any.

dclick = Str

The optional extended trait name of the trait that should be assigned a node object when a tree node is double-clicked on (Note: if you want to receive repeated double-clicks on the same node, make sure the trait is defined as an Event):

dock_theme = Instance(DockWindowTheme)

The DockWindow graphical theme

editable = Bool(True)

Are the individual nodes editable?

editor = Instance(EditorFactory)

Reference to a shared object editor

expands_on_dclick = Bool(True)

Whether or not to expand on a double-click.

hide_root = Bool(False)

Hide the tree root node?

icon_size = IconSize

Size of the tree node icons

lines_mode = Enum('appearance', 'on', 'off')

Mode for lines connecting tree nodes

  • ‘appearance’: Show lines only when they look good.
  • ‘on’: Always show lines.
  • ‘off’: Don’t show lines.
multi_nodes = Dict

Mapping from TreeNode tuples to MultiTreeNodes

nodes = List(TreeNode)

Supported TreeNode objects

on_activated = Any

Called when a node is activated

on_click = Any

Called when a node is clicked

on_dclick = Any

Called when a node is double-clicked

on_hover = Any

Call when the mouse hovers over a node

on_select = Any

Called when a node is selected

orientation = Orientation

Layout orientation of the tree and the editor

refresh = Str

The optional extended trait name of the trait event that is fired when the application wishes the currently visible portion of the tree widget to repaint itself.

selected = Str

The optional extended trait name of the trait to synchronize with the editor’s current selection:

selection_mode = Enum('single', 'extended')

Selection mode.

shared_editor = Bool(False)

Is the editor shared across trees?

show_icons = Bool(True)

Show icons for tree nodes?

vertical_padding = Int(0)

Any extra vertical padding to add.

veto = Str

The optional extended trait name of the trait event that is fired whenever the application wishes to veto a tree action in progress (e.g. double-clicking a non-leaf tree node normally opens or closes the node, but if you are handling the double-click event in your program, you may wish to veto the open or close operation). Be sure to fire the veto event in the event handler triggered by the operation (e.g. the ‘dclick’ event handler.

word_wrap = Bool(False)

Whether the labels should be wrapped around, if not an ellipsis is shown This works only in the qt backend and if there is only one column in tree

traitsui.editors.tree_editor.TreeEditor

Define the TreeEditor class.

alias of traitsui.editors.tree_editor.ToolkitEditorFactory

Previous topic

traitsui.editors.title_editor module

Next topic

traitsui.editors.tuple_editor module

This Page