The ideas for the implementation of this widget are based on the
Hierarchical browser discussed in Effective Tcl/Tk Programming
by Mark Harrison and Michael McLennan.
Methods
|
|
|
|
__init__
|
__init__ (
self,
parent=None,
**kw,
)
Create a TreeNavigator widget.
Create a new instance with our parent widget and the treedata
to be displayed.
Options
-
activebackground Background color for active nodes.
-
autoexpand Boolean indicating whether or not to
atuomatically expand nodes in the tree.
-
command Callback to be executed when nodes are
selected.
-
doubleclickcommand Callback to be executed when nodes
are double clicked.
-
entercommand Callback to be executed when pointer
enters node.
-
iconheight Height to use for all icons.
-
iconwidth Width to use for all icons.
-
indent Amount of space to indent each child node level.
-
ipadx Internal padding (X).
-
ipady Internal padding (Y).
-
leavecommand Callback to be executed when mouse pointer
leaves the node.
-
selectedbackground Background color to use to show a
node when it was selected by the user.
-
treedata The NavigableTree instance to be displayed.
|
|
build_mark_name
|
build_mark_name ( self, levels=() )
Create a name for the mark representing the position of the given levels.
Given a tuple of level indeces, create a name of the form
root-1-1-... to be used as the unique marker name for the
node.
|
|
deselect_node
|
deselect_node ( self, node )
Remove selection from a node.
|
|
enter_node
|
enter_node ( self, node )
Called when the mouse enters the node area.
|
|
expand_node
|
expand_node (
self,
node,
insert_expanded=0,
)
Either expand or collapse the node.
|
|
getcurselection
|
getcurselection ( self )
Returns the current selection of the TreeNavigator.
|
|
highlight_node
|
highlight_node (
self,
node,
color='white',
)
Draw the node in our highlight color.
|
|
insert_node
|
insert_node (
self,
node,
levels=(),
counter=1,
insert_expanded=0,
)
Insert a node in the tree.
Given a node, the level tuple indicating where it goes, and the counter
indicating its sibling order, insert a representation of the node at
the appropriate place. The node's parent or older sibling (smaller counter)
needs to be in place already.
If insert_expanded is true, the children of the node are also inserted.
|
|
is_selected
|
is_selected ( self, node )
Determine if the given node is currently selected.
|
|
leave_node
|
leave_node ( self, node )
Called when the mouse leaves the node area.
|
|
reset_selection
|
reset_selection ( self, parent )
Reset the selection.
|
|
select_node
|
select_node ( self, node )
Called when a node is selected by clicking on the text.
|
|
select_node_icon
|
select_node_icon ( self, node )
Update the icon for the node because it is selected.
|
|
setcurselection
|
setcurselection ( self, new_selection )
Set the current selection.
|