gtk.TreeViewa widget for displaying both trees and lists.Synopsisgtk.TreeViewgtk.Containergtk.TreeViewmodelNoneget_modelset_modelmodelNoneget_selectionget_hadjustmentset_hadjustmentadjustmentget_vadjustmentset_vadjustmentadjustmentget_headers_visibleset_headers_visibleheaders_visiblecolumns_autosizeset_headers_clickableactiveset_rules_hintsettingget_rules_hintappend_columncolumnremove_columncolumninsert_columncolumnpositioninsert_column_with_attributespositiontitlecell...insert_column_with_data_funcpositiontitlecellfuncdataNoneget_columnnget_columnsmove_column_aftercolumnbase_columnset_expander_columncolumnget_expander_columnset_column_drag_functionfuncuser_datascroll_to_pointtree_xtree_yscroll_to_cellpathcolumnuse_alignrow_aligncol_alignrow_activatedpathcolumnexpand_allcollapse_allexpand_to_pathpathexpand_rowpathopen_allcollapse_rowpathmap_expanded_rowsfuncdatarow_expandedpathset_reorderablereorderableget_reorderableset_cursorpathfocus_columnNonestart_editingFalseset_cursor_on_cellpathfocus_columnNonefocus_cellNonestart_editingFalseget_cursorget_bin_windowget_path_at_posxyget_cell_areapathcolumnget_background_areapathcolumnget_visible_rectwidget_to_tree_coordswxwytree_to_widget_coordstxtyenable_model_drag_sourcestart_button_masktargetsactionsenable_model_drag_desttargetsactionsunset_rows_drag_sourceunset_rows_drag_destset_drag_dest_rowpathposget_drag_dest_rowget_dest_row_at_posxycreate_row_drag_iconpathset_enable_searchenable_searchget_enable_searchget_search_columnset_search_columncolumnset_search_equal_funcfuncNoneuser_dataNoneget_fixed_height_modeset_fixed_height_modeenableget_hover_selectionset_hover_selectionhoverget_hover_expandset_hover_expandexpandset_row_separator_funcfuncNoneuser_dataNoneget_visible_rangeget_headers_clickableget_search_entryset_search_entryentryNoneset_search_position_funcfuncdataNoneset_rubber_bandingenableget_rubber_bandingget_grid_linesset_grid_linesgrid_linesget_enable_tree_linesset_enable_tree_linesenabledconvert_widget_to_bin_window_coordswidget_xwidget_yconvert_widget_to_tree_coordswidget_xwidget_yconvert_tree_to_widget_coordstree_xtree_yconvert_tree_to_bin_window_coordstree_xtree_yconvert_bin_window_to_widget_coordswindow_xwindow_yconvert_bin_window_to_tree_coordswindow_xwindow_yget_level_indentationset_level_indentationindentationget_show_expandersset_show_expandersenabledget_tooltip_columnset_tooltip_columncolumnis_rubber_banding_activeset_tooltip_celltooltippathcolumncellset_tooltip_rowtooltippathAncestry+-- gobject.GObject
+-- gtk.Object
+-- gtk.Widget
+-- gtk.Container
+-- gtk.TreeView
Implemented Interfacesgtk.TreeView
implements
gtk.Buildablegtk.TreeView Propertiesgtk.Object Propertiesgtk.Widget Propertiesgtk.Container Properties
"enable-grid-lines"Read-WriteIf True grid lines should be drawn
in the tree view"enable-search"Read-WriteIf True, the user can search through
columns interactively. Default value: True"enable-tree-lines"Read-WriteIf True tree lines should be drawn
in the tree view"expander-column"Read-WriteThe column for the expander"fixed-height-mode"Read-WriteIf True, assume all rows have the
same height thereby speeding up display. Default value:
False. Available in GTK+ 2.4 and above."hadjustment"Read-WriteThe horizontal Adjustment for the widget"headers-clickable"WriteIf True, the column headers respond
to click events. Default value: False"headers-visible"Read-WriteIf True, show the column header
buttons. Default value: True"hover-expand"Read-WriteIf True, rows expand or collapse if
the pointer moves over them. This mode is primarily intended for treeviews
in popups, e.g. in gtk.ComboBox or
gtk.EntryCompletion. Default
value: False. Available in GTK+ 2.6 and above."hover-selection"Read-WriteIf True, the selected row follows
the pointer. Currently, this works only for the selection modes
gtk.SELECTION_SINGLE and
gtk.SELECTION_BROWSE. This mode is primarily intended for
treeviews in popups, e.g. in gtk.ComboBox or
gtk.EntryCompletion. Default
value: False. Available in GTK+ 2.6 and above."level-indentation"Read-WriteExtra indentation for each level"model"Read-WriteThe model for the tree view"reorderable"Read-WriteIf True, the view is
reorderable. Default value: False."rubber-banding"Read-WriteIf True enable selection of multiple
items by dragging the mouse pointer"rules-hint"Read-WriteIf True, hint to the theme engine to
draw rows in alternating colors. Default value:
False."search-column"Read-WriteThe model column to search when searching through
code. Allowed values: >= -1. Default value: -1"show-expanders"Read-WriteView has expanders"vadjustment"Read-WriteThe vertical Adjustment for the widget
gtk.TreeView Style Properties
"allow-rules"ReadIf True, allow drawing of
alternating color rows. Default value: True"even-row-color"ReadThe gtk.gdk.Color
to use for even rows. Available in GTK+ 2.2 and above."expander-size"ReadThe size of the expander arrow. Allowed values: >= 0.
Default value: 12"grid-line-pattern"ReadDash pattern used to draw the tree view grid lines"grid-line-width"ReadWidth, in pixels, of the tree view grid lines"horizontal-separator"ReadThe horizontal space between cells. Must be an even
number. Allowed values: >= 0. Default value: 2"indent-expanders"ReadIf True, the expanders are
indented."odd-row-color"ReadThe gtk.gdk.Color
to use for odd rows. Available in GTK+ 2.2 and above."row-ending-details"ReadEnable extended row background theming"tree-line-pattern"ReadDash pattern used to draw the tree view lines"tree-line-width"ReadWidth, in pixels, of the tree view lines"vertical-separator"ReadThe vertical space between cells. Must be an even
number. Allowed values: >= 0. Default value: 2
gtk.TreeView Signal Prototypesgobject.GObject Signal Prototypesgtk.Object Signal Prototypesgtk.Widget Signal Prototypesgtk.Container Signal Prototypes"columns-changed"callbacktreeviewuser_param1..."cursor-changed"callbacktreeviewuser_param1..."expand-collapse-cursor-row"callbacktreeviewlogicalexpandopen_alluser_param1..."move-cursor"callbacktreeviewstepcountuser_param1..."row-activated"callbacktreeviewpathview_columnuser_param1..."row-collapsed"callbacktreeviewiterpathuser_param1..."row-expanded"callbacktreeviewiterpathuser_param1..."select-all"callbacktreeviewuser_param1..."select-cursor-parent"callbacktreeviewuser_param1..."select-cursor-row"callbacktreeviewstart_editinguser_param1..."set-scroll-adjustments"callbacktreeviewhadjustmentvadjustmentuser_param1..."start-interactive-search"callbacktreeviewuser_param1..."test-collapse-row"callbacktreeviewiterpathuser_param1..."test-expand-row"callbacktreeviewiterpathuser_param1..."toggle-cursor-row"callbacktreeviewuser_param1..."unselect-all"callbacktreeviewuser_param1...DescriptionA gtk.TreeView
widget is used to display the contents of any model implementing the gtk.TreeModel
interface. The tree models provided standard with GTK+
and PyGTK are:gtk.ListStoregtk.TreeStoregtk.TreeModelSortIn addition, PyGTK provides gtk.GenericTreeModel
that allows you to create your own tree model entirely in Python.The gtk.TreeView uses
columns and cell renderers to actually display the model information.
GTK+ and PyGTK provides the gtk.TreeViewColumn
to manage the display of a column and the following cell renderers:gtk.CellRendererPixbufgtk.CellRendererTextgtk.CellRendererToggleIn addition, PyGTK provides the gtk.GenericCellRenderer
that allows you to create your own cell renderers entirely in Python.Constructorgtk.TreeViewmodelNonemodel :the tree model to displayReturns :A new gtk.TreeView
widget.Creates a new gtk.TreeView
widget displaying the model specified by model.Methodsgtk.TreeView.get_modelget_modelReturns :the current gtk.TreeModel, or
None if none is currently being
used.The get_model() method returns the
value of the "model" property containing the model the gtk.TreeView is
displaying or None there is no the model.gtk.TreeView.set_modelset_modelmodelNonemodel :the new tree model to use with the
treeviewThe set_model() method sets the "model"
property for the treeview to the value of model. If
the treeview already has a model set, this method will remove it before
setting the new model. If model is
None, it will unset the old model.gtk.TreeView.get_selectionget_selectionReturns :A gtk.TreeSelection
object.The get_selection() method returns the
current gtk.TreeSelection
associated with the treeview.gtk.TreeView.get_hadjustmentget_hadjustmentReturns :a gtk.Adjustment
object, or None if none is currently being
used.The get_hadjustment() method returns
the value of the "hadjustment" property that contains the current horizontal
gtk.Adjustment
object or None (if no horizontal adjustment is being
used).gtk.TreeView.set_hadjustmentset_hadjustmentadjustmentadjustment :the gtk.Adjustment
to setThe set_hadjustment() method sets the
"hadjustment" property to the value of adjustment
that must be a gtk.Adjustment
object.gtk.TreeView.get_vadjustmentget_vadjustmentReturns :a gtk.Adjustment
object, or None if none is currently being
used.The get_vadjustment() method returns
the value of the "vadjustment" property that contains the horizontal gtk.Adjustment
or None if there is no vertical adjustment.gtk.TreeView.set_vadjustmentset_vadjustmentadjustmentadjustment :the gtk.Adjustment
to setThe set_vadjustment() method sets the
"vadjustment" property to the value of adjustment.
The new gtk.Adjustment
replaces the current vertical adjustment.gtk.TreeView.get_headers_visibleget_headers_visibleReturns :True if the headers are
visible.The get_headers_visible() method
returns the value of the "headers-visible" property. If "headers-visible" is
True the headers on the treeview are visible.gtk.TreeView.set_headers_visibleset_headers_visibleheaders_visibleheaders_visible :if True the headers are
visibleThe set_headers_visible() method sets
the "headers-visible" property to the value of
headers_visible. If
headers_visible is True the
headers will be displayed.gtk.TreeView.columns_autosizecolumns_autosizeThe columns_autosize() method resizes
all columns to their optimal width. Only works after the treeview has been
realized.gtk.TreeView.set_headers_clickableset_headers_clickableactiveactive :if True the headers are
clickableThe set_headers_clickable() method sets
the "headers-clickable" property to the value of
active. If active is
True the column title buttons can be clicked.gtk.TreeView.set_rules_hintset_rules_hintsettingsetting :if True the tree requires
reading across rowsThe set_rules_hint() method sets the
"rules-hint" property to the value of setting. If
setting is True it indicates that
the user interface for your application requires users to read across tree
rows and associate cells with one another. By default, the tree will be
rendered with alternating row colors. Do not use it
just because you prefer the appearance of the ruled tree; that's a question
for the theme. Some themes will draw tree rows in alternating colors even
when rules are turned off, and users who prefer that appearance all the time
can choose those themes. You should call this method only as a
semantic hint to the theme engine that your tree makes
alternating colors useful from a functional standpoint (since it has lots of
columns, generally).gtk.TreeView.get_rules_hintget_rules_hintReturns :True if rules are useful for
the user of this treeThe get_rules_hint() returns the value
of the "rules-hint" property. See the set_rules_hint()
method for more information on the use of "rules-hint".gtk.TreeView.append_columnappend_columncolumncolumn :the gtk.TreeViewColumn
to add.Returns :the number of columns in
tree_view after appending.The append_column() method appends the
specified column to the list of columns and returns
the new number of columns in the treeview.gtk.TreeView.remove_columnremove_columncolumncolumn :the gtk.TreeViewColumn
to remove.Returns :the number of columns in the treeview after the
column removal.The remove_column() method removes the
specified column from the treeview.gtk.TreeView.insert_columninsert_columncolumnpositioncolumn :the gtk.TreeViewColumn
to be inserted.position :the position to insert
column.Returns :the number of columns in the treeview after the
insertion.The insert_column() method inserts the
specified column into the treeview at the location
specified by position. If
position is -1, then the column is inserted at the
end.gtk.TreeView.insert_column_with_attributesinsert_column_with_attributespositiontitlecell...position :the position to insert the new column
in.title :the title to set the header
to.cell :the gtk.CellRenderer.... :optional keyword-value
argumentsReturns :the gtk.TreeViewColumn
that was inserted.The insert_column_with_attributes()
method creates a new gtk.TreeViewColumn
and inserts it into the treeview at the location specified by
position with the column title specified by
title and using the gtk.CellRenderer
specified by cell. If position
is -1, then the newly created column is inserted at the end. The column is
initialized with the optional attributes passed as keyword-value pairs (e.g.
text=0, foreground=2). See the gtk.TreeViewColumn.add_attribute()
method for more information.gtk.TreeView.insert_column_with_data_funcinsert_column_with_data_funcpositiontitlecellfuncdataNoneposition :the position to insert, -1 for
appendtitle :the column titlecell :a cell renderer for the
columnfunc :the function or method to set attributes of the
cell rendererdata :the data to pass with
funcReturns :the number of columns in the treeview after the
insertionThe insert_column_with_data_func()
method is a convenience function that inserts a new column into the treeview
at the location specified by position with the
specified title and the cell renderer specified by
cell and using the function or method specified by
func to set cell renderer attributes (normally using
data from the model). The signature of func is:celldatafunctioncolumncellmodeliteruser_datacelldatamethodselfcolumncellmodeliteruser_datawhere column is the gtk.TreeViewColumn
in the treeview, cell is the gtk.CellRenderer
for column, model is the gtk.TreeModel for
the treeview and iter is the gtk.TreeIter
pointing at the row. See the gtk.TreeViewColumn.set_cell_data_func()
and gtk.TreeViewColumn.pack_start()
methods for more detail.gtk.TreeView.get_columnget_columnnn :the position of the column, counting from
0.Returns :the gtk.TreeViewColumn,
or None if the position is outside the range of
columns.The get_column() method returns the
gtk.TreeViewColumn
at the specified position in the treeview.gtk.TreeView.get_columnsget_columnsReturns :a list of gtk.TreeViewColumn
sThe get_columns() method returns a list
of all the gtk.TreeViewColumn
objects currently in the treeview.gtk.TreeView.move_column_aftermove_column_aftercolumnbase_columncolumn :the gtk.TreeViewColumn
to be moved.base_column :the gtk.TreeViewColumncolumn is to be after, or
None.The move_column_after() method moves
the gtk.TreeViewColumn
specified by column to be after the treeview column
specified by base_column. If
base_column is None, then
column is placed in the first position.gtk.TreeView.set_expander_columnset_expander_columncolumncolumn :the column to draw the expander arrow at
orNone.The set_expander_column() method sets
the "expander-column" property to the value of column
which must be a gtk.TreeViewColumn
in the treeview. If column is
None, then the expander arrow is always at the first
visible column.gtk.TreeView.get_expander_columnget_expander_columnReturns :the expander column.The get_expander_column() method
returns the value of the "expander-column" property that contains the
current expander column i.e. the column that has the expander arrow drawn
next to it.gtk.TreeView.set_column_drag_functionset_column_drag_functionfuncuser_datafunc :A function to determine which columns are reorderable, or None.user_data :User data to be passed to func, or NoneThis method is available in PyGTK 2.4 and above.The set_column_drag_function() method
sets the user function specified by func for
determining where a column may be dropped when dragged. The user function is
called on every column pair in turn at the beginning of a column drag to
determine where a drop can take place. The signature of
func is:
def func(tree_view, column, prev_column, next_column, data)
where tree_view is the gtk.TreeView,
column is the gtk.TreeViewColumn
being dragged, prev_column and next_column are the two gtk.TreeViewColumn
objects bracketing the drop spot, and data is
user_data. If prev_column or
next_column is None, then the drop
is at an edge. If func is None,
the user drag function is removed and the gtk.TreeView
reverts to the default behavior of allowing any reorderable column to be
dropped anywhere.gtk.TreeView.scroll_to_pointscroll_to_pointtree_xtree_ytree_x :the X coordinate of new top-left pixel of
visible area, or -1tree_y :the Y coordinate of new top-left pixel of
visible area, or -1The scroll_to_point() method scrolls
the treeview so that the top-left corner of the visible area is at the
location specified by tree_x and
tree_y, where tree_x and
tree_y are specified in tree window coordinates. The
treeview must be realized before this method is called. If it isn't, you
should use the scroll_to_cell()
method instead. If either tree_x or
tree_y are -1, there is no scrolling in that
direction.gtk.TreeView.scroll_to_cellscroll_to_cellpathcolumnNoneuse_alignFalserow_align0.0col_align0.0path :the path of the row to move
tocolumn :the gtk.TreeViewColumn
to move horizontally to, or None.use_align :if True use the alignment
argumentsrow_align :the vertical alignment of the row specified by
path.col_align :the horizontal alignment of the column
specified by column.The scroll_to_cell() method scrolls the
treeview display to the position specified by column
and path. If column is
None, no horizontal scrolling occurs. The alignment
parameters specified by row_align and
col_align determines where
column is placed within the treeview. The values of
col_align and row_align range
from 0.0 to 1.0. The alignment values specify the fraction of display space
that is to the left of or above the cell. If
use_align is False, the alignment
arguments are ignored, and the tree does the minimum amount of work to
scroll the cell onto the screen. This means that the cell will be scrolled
to the edge closest to it's current position. If the cell is currently
visible on the screen, nothing is done. This method only works if the model
is set, and path is a valid row in the model.gtk.TreeView.row_activatedrow_activatedpathcolumnpath :the tree path of the row of the cell to be
activated.column :the gtk.TreeViewColumn
of the cell to be activated.The row_activated() method activates
the cell determined by path and
column.gtk.TreeView.expand_allexpand_allThe expand_all() method recursively
expands all nodes in the treeview.gtk.TreeView.collapse_allcollapse_allThe collapse_all() method recursively
collapses all visible, expanded nodes in the treeview.gtk.TreeView.expand_to_pathexpand_to_pathpathpath :a path to a row.This method is available in PyGTK 2.2 and above.The expand_to_row() method expands the
row with the tree path specified by path. This will
also expand all parent rows of path as
necessary.gtk.TreeView.expand_rowexpand_rowpathopen_allpath :the path to a rowopen_all :if True recursively expand,
otherwise just expand immediate childrenThe expand_row() method opens the row
specified by path so its children are visible. If
open_all is True all rows are
expanded, otherwise only the immediate children of
path are expanded.gtk.TreeView.collapse_rowcollapse_rowpathpath :the path to a rowThe collapse_row() method collapses the
row specified by path (hides its child rows, if they
exist).gtk.TreeView.map_expanded_rowsmap_expanded_rowsfuncdatafunc :A function to be calleddata :User data to be passed to the function.This method is available in PyGTK 2.2 and above.The map_expanded_rows() method calls
the function specified by func on all expanded rows
passing data as an argument.gtk.TreeView.row_expandedrow_expandedpathpath :the path to a row to test the expansion
state.Returns :True if
path is expanded.The row_expanded() method returns
True if the node pointed to by
path is expanded.gtk.TreeView.set_reorderableset_reorderablereorderablereorderable :if True, the tree can be
reordered.The set_reorderable() method sets the
"reorderable" property to the value of reorderable.
This method is a convenience method to allow you to reorder models that
support the gtk.TreeDragSource
and the gtk.TreeDragDest
interfaces. Both gtk.TreeStore and
gtk.ListStore
support these. If reorderable is
True, then the user can reorder the model by dragging and
dropping rows. The application can listen to these changes by connecting to
the model's signals.This function does not give you any degree of control over the
order -- any reordering is allowed. If more control is needed, you should
probably handle drag and drop manually.gtk.TreeView.get_reorderableget_reorderableReturns :True if the tree can be
reordered.The get_reorderable() method returns
the value of the "reorderable" property that determines if the user can
reorder the tree via drag-and-drop. See the set_reorderable()
method for more information.gtk.TreeView.set_cursorset_cursorpathfocus_columnNonestart_editingFalsepath :a tree pathfocus_column :a gtk.TreeViewColumn,
or Nonestart_editing :if True the specified cell
should start being edited.The set_cursor() method sets the
current keyboard focus to be at the row specified by
path, and selects it. This is useful when you want to
focus the user's attention on a particular row. If
column is not None, then focus is
given to the specified column. Additionally, if
column is specified, and
start_editing is True, then
editing should be started in the specified cell. This method is often
followed by the gtk.Widget.grab_focus()
method to give keyboard focus to the treeview. Please note that editing can
only happen when the widget is realized.gtk.TreeView.set_cursor_on_cellset_cursor_on_cellpathfocus_columnNonefocus_cellNonestart_editingFalsepath :a tree pathfocus_column :a gtk.TreeViewColumn,
or Nonefocus_cell :a gtk.CellRenderer,
or Nonestart_editing :True if the specified cell
should start being edited.This method is available in PyGTK 2.2 and above.The set_cursor_on_cell() method sets
the current keyboard focus to be at the node specified by
path, and selects it. This is useful when you want
to focus the user's attention on a particular row. If
focus_column is specified, focus is given to that
column. If focus_column and
focus_cell are specified, and
focus_column contains 2 or more editable or
activatable cells, then focus is given to the cell specified by
focus_cell. Additionally, if
focus_column is specified, and
start_editing is True, editing
should be started in the specified cell. This method is often followed by
the gtk.Widget.grab_focus()
method in order to give keyboard focus to the widget. Please note that
editing can only happen when the widget is realized.gtk.TreeView.get_cursorget_cursorReturns :a tuple containing the current cursor path and
focus column.The get_cursor() method returns a tuple
containing the current path and focus column. If the cursor isn't currently
set, the current path will be None. If no column
currently has focus, the current focus column will be
None.gtk.TreeView.get_bin_windowget_bin_windowReturns :a gtk.gdk.Window, or
NoneThe get_bin_window() method returns the
window that the treeview renders to or None if the
treeview is not realized yet. This is used primarily to compare to the
event.window attribute to confirm that the event on the
treeview is on the right window.gtk.TreeView.get_path_at_posget_path_at_posxyx :The x position to be
identified.y :The y position to be
identified.Returns :a tuple containing: a tree path; a gtk.TreeViewColumn
object; the X coordinate relative to the cell; and, the Y
coordinate relative to the cell. If there is no path at the
position None is returned.The get_path_at_pos() method returns a
tuple containing:the path at the specified point
(x, y), relative to widget
coordinatesthe gtk.TreeViewColumn
at that pointthe X coordinate relative to the cell
backgroundthe Y coordinate relative to the cell
backgroundx and y are
relative to the coordinates of an event on the treeview only when
event.window==treeview.get_bin_window(). It is primarily
used for popup menus. This method is only meaningful if the treeview is
realized. This method returns None if there is no path at
the position.gtk.TreeView.get_cell_areaget_cell_areapathcolumnpath :a tree path for the rowcolumn :a gtk.TreeViewColumn
for the columnReturns :rectangleThe get_cell_area() method returns the
bounding gtk.gdk.Rectangle
in tree window coordinates for the cell at the row specified by
path and the column specified by
column. If path points to a
path not currently displayed, the y and
height attributes of the rectangle will be 0. The sum
of all cell rects does not cover the entire tree; there are extra pixels in
between rows, for example. The returned rectangle is equivalent to the
cell_area passed to the gtk.CellRenderer.render()
method. This method is only valid if the treeview is realized.gtk.TreeView.get_background_areaget_background_areapathcolumnpath :a tree path for the row,column :a gtk.TreeViewColumn
for the columnReturns :a rectangleThe get_background_area() method
returns the bounding gtk.gdk.Rectangle
in tree window coordinates for the cell at the row specified by
path and the column specified by
column. If path points to a
node not found in the tree, the y and
height attributes of the rectangle will be 0. The
returned rectangle is equivalent to the
background_area passed to the gtk.CellRenderer.render().
These background areas tile to cover the entire tree window (except for the
area used for header buttons). Contrast with the
cell_area, returned by the get_cell_area()
method, that returns only the cell itself, excluding the surrounding borders
and the tree expander area.gtk.TreeView.get_visible_rectget_visible_rectReturns :a rectangleThe get_visible_rect() method returns
the bounding gtk.gdk.Rectangle
for the currently visible region of the treeview widget, in tree
coordinates. Convert to widget coordinates with the tree_to_widget_coords().
Tree coordinates start at 0,0 for row 0 of the tree, and cover the entire
scrollable area of the tree.gtk.TreeView.widget_to_tree_coordswidget_to_tree_coordswxwywx :the widget X coordinatewy :the widget Y coordinateReturns :a tuple containing the tree X and Y
coordinatesThe widget_to_tree_coords() method
returns a tuple containing the tree X and Y coordinates for the widget
coordinates specified by wx and
wy. The tree coordinates cover the full scrollable
area of the tree.gtk.TreeView.tree_to_widget_coordstree_to_widget_coordstxtytx :tree X coordinatety :tree Y coordinateReturns :a tuple containing the widget X and Y
coordinatesThe tree_to_widget_coords() method
returns a tuple containing the widget coordinates for the tree coordinates
specified by tx and ty.gtk.TreeView.enable_model_drag_sourceenable_model_drag_sourcestart_button_masktargetsactionsstart_button_mask :the bitmask of buttons that can start the
dragtargets :a sequence of tuples containing target
dataactions :the possible actions for a
dragThe enable_model_drag_source() method
sets the treeview to start a drag operation when the user click and
drags on a row. The value of start_button_mask
is a combination of the.targets is a sequence (list or tuple) of
tuples that contain information about the targets. The target data
contains a string representing the drag type, target flags (a
combination of the ) and an application
assigned integer ID used for identification purposes.The value of actions is one of the .gtk.TreeView.enable_model_drag_destenable_model_drag_desttargetsactionstargets :a sequence of tuples containing target
dataactions :the possible actions for a
dragThe enable_model_drag_dest() method
sets the treeview to receive a drag drop.targets is a sequence (list or tuple) of
tuples that contain information about the targets. The target data
contains a string representing the drag type, target flags (a
combination of gtk.TARGET_SAME_APP and
gtk.TARGET_SAME_WIDGET or neither) and an
application assigned integer ID used for identification
purposes.The value of actions is one of the .gtk.TreeView.unset_rows_drag_sourceunset_rows_drag_sourceThe unset_rows_drag_source() method
unsets the drag source information.gtk.TreeView.unset_rows_drag_destunset_rows_drag_destThe unset_rows_drag_dest() method
unsets the drag destination information.gtk.TreeView.set_drag_dest_rowset_drag_dest_rowpathpospath :a tree path of the row to highlight, or
None.pos :a drop positionThe set_drag_dest_row() method sets the
treeview drag destination row to the value specified by
path with the drop position specified by
pos. The value of pos must be
one of: gtk.TREE_VIEW_DROP_BEFORE,
gtk.TREE_VIEW_DROP_AFTER,
gtk.TREE_VIEW_DROP_INTO_OR_BEFORE or
gtk.TREE_VIEW_DROP_INTO_OR_AFTER.In PyGTK 2.10 and above, path may be
None.gtk.TreeView.get_drag_dest_rowget_drag_dest_rowReturns :a 2-tuple containing the tree path and the drop
position relative to the tree path or
NoneThe get_drag_dest_row() method returns
a 2-tuple containing the path of the drag destination row and a drop
position relative to the destination row. The drop position is one of:
gtk.TREE_VIEW_DROP_BEFORE,
gtk.TREE_VIEW_DROP_AFTER,
gtk.TREE_VIEW_DROP_INTO_OR_BEFORE or
gtk.TREE_VIEW_DROP_INTO_OR_AFTER. This method returns
None if no drag destination row is set.gtk.TreeView.get_dest_row_at_posget_dest_row_at_posxyx :the x coordinate of the
positiony :the y coordinate of the
positionReturns :a 2-tuple containing the path of the row and
the drop position at the position specified by x and
y or NoneThe get_dest_row_at_pos() method
returns a 2-tuple containing the path of the row and the drop position
relative to the row of the position specified by x
and y. The drop position is one of:
gtk.TREE_VIEW_DROP_BEFORE,
gtk.TREE_VIEW_DROP_AFTER,
gtk.TREE_VIEW_DROP_INTO_OR_BEFORE or
gtk.TREE_VIEW_DROP_INTO_OR_AFTER.gtk.TreeView.create_row_drag_iconcreate_row_drag_iconpathpath :a tree pathReturns :a new pixmap of the drag
icon.The create_row_drag_icon() method
creates a gtk.gdk.Pixmap
representation of the row specified by path. This
image is used for a drag icon.gtk.TreeView.set_enable_searchset_enable_searchenable_searchenable_search :if True, the user can search
interactivelyThe set_enable_search() method sets the
"enable-search" property to the value of
enable_search. If
enable_search is True the user can
type in text to search through the tree interactively.gtk.TreeView.get_enable_searchget_enable_searchReturns :True if the user can search
interactivelyThe get_enable_search() method returns
the value of the "enable-search" property. If "enable-search" is
True the tree allows interactive searching.gtk.TreeView.get_search_columnget_search_columnReturns :the column the interactive search code
searches.The get_search_column() method returns
the value of the "search-column" property that is the column searched by
the interactive search code.gtk.TreeView.set_search_columnset_search_columncolumncolumn :the column to searchThe set_search_column() method sets the
"search-column" property to the value of column. The
value of column is the column where the interactive
search code should search. Additionally, this method turns on interactive
searching (see the set_enable_search()
method).gtk.TreeView.set_search_equal_funcset_search_equal_funcfuncNoneuser_dataNonefunc :the compare function to use during the search or Noneuser_data :user data to pass to func, or NoneThis method is available in PyGTK 2.4 and above.The set_search_equal_func() method sets
the compare function for the interactive search capabilities to the function
specified by func. If
user_data is specified and not
None, it is passed to func. If
func is None, the default gtk.TreeView
search equal function will be used. The signature of
func is:
def func(model, column, key, iter, data)
where model is the gtk.TreeModel of
the gtk.TreeView,
column is the number of the column being searched
(see the set_search_column()
method for more information), key is the string being
searched for, iter is a gtk.TreeIter
pointing to the current candidate row and data is the
context data user_data. func
should return False to indicate that the row matches the
search criteria.gtk.TreeView.get_fixed_height_modeget_fixed_height_modeReturns :True if fixed height mode
is enabled.This method is available in PyGTK 2.6 and above.The get_fixed_height_mode() method
returns the value of the "fixed-height-mode" property. If the
"fixed-height-mode" property is True, all rows are
assumed to be the same height.gtk.TreeView.set_fixed_height_modeset_fixed_height_modeenableenable :if True enable fixed height
mode.This method is available in PyGTK 2.6 and above.The set_fixed_height_mode() method sets
the "fixed-height-mode" property to the value of
enable. If enable is
True all rows are assumed to have the same height which
speeds up gtk.TreeView
displays. Only enable this option if all rows are the same height and all
columns are of type gtk.TREE_VIEW_COLUMN_FIXED (see the
).gtk.TreeView.get_hover_selectionget_hover_selectionReturns :True if hover selection
mode is enabled.This method is available in PyGTK 2.6 and above.The get_hover_selection() method
returns the value of the "hover-selection" property. If the
"hover-selection" property is True the selected row
follows the pointer. See the set_hover_selection()
method for more detail.gtk.TreeView.set_hover_selectionset_hover_selectionhoverhover :if True enable hover
selection mode.This method is available in PyGTK 2.6 and above.The () method sets the
"hover-selection" property to the value of hover. If
hover is True the hover selection
mode is enables and the selected row follows the pointer. Currently, this
works only for the selection modes gtk.SELECTION_SINGLE
and gtk.SELECTION_BROWSE (see the ).gtk.TreeView.get_hover_expandget_hover_expandReturns :True if hover expand mode is
enabledThis method is available in PyGTK 2.6 and above.The get_hover_expand() method returns
the value of the "hover-expand" property. If the "hover-expand" property is
True rows expand or collapse if the pointer moves over
them.gtk.TreeView.set_hover_expandset_hover_expandexpandexpand :if True enable hover expand
mode.This method is available in PyGTK 2.6 and above.The set_hover_expand() method sets the
"hover-expand" property to the value of expand. If
expand is True, rows expand or
collapse if the pointer moves over them. gtk.TreeView.set_row_separator_funcset_row_separator_funcfuncNoneuser_dataNonefunc :the row separator function or
Noneuser_data :user data to pass to func, or NoneThis method is available in PyGTK 2.6 and above.The set_row_separator_func() method
sets the row separator function to the function specified by
func. The row separator function is used to determine
if a row should be displayed as a separator. If
user_data is specified and not
None, it is passed to func. If
func is None, no separators will
be drawn. The signature of func is:
def func(model, iter, data)
where model is the gtk.TreeModel of
the gtk.TreeView,
iter is a gtk.TreeIter
pointing to the current candidate row and data is the
context data user_data. func
should return True to indicate that the row is a
separator.A common way to implement this is to have a boolean column in
model, whose values func
returns.gtk.TreeView.get_visible_rangeget_visible_rangeReturns :a 2-tuple containing the start and end paths of
the visible region or None.This method is available in PyGTK 2.10 and above.The get_visible_range() method returns
a 2-tuple containing the start and end paths for the visible region in the
treeview. If no valid paths are available this method returns
None.gtk.TreeView.get_headers_clickableget_headers_clickableReturns :True if all header columns
are clickableThis method is available in PyGTK 2.10 and above.Returns True if all header columns are
clickable.gtk.TreeView.get_search_entryget_search_entryReturns :the entry currently in use as the search
entry.This method is available in PyGTK 2.10 and above.Returns the gtk.Entry which
is currently in use as the interactive search entry for the treeview.
In case the built-in entry is being used, None will
be returned.gtk.TreeView.set_search_entryset_search_entryentryNoneentry :the entry the interactive search code of the
treeview should use or
NoneThis method is available in PyGTK 2.10 and above.Sets the entry which the interactive search code will use for
this treeview. This is useful when you want to provide a search entry
in our interface at all time at a fixed position. Passing
None for entry will make the
interactive search code use the built-in popup entry again.gtk.TreeView.set_search_position_funcset_search_position_funcfuncdataNonefunc :the function to use to position the search
dialog, or None to use the default search
position functiondata :user data to pass to
func, or
NoneThis method is available in PyGTK 2.10 and above.Sets the function to use when positioning the search dialog. The
signature of func is:
def func(treeview, search_dialog, user_data):
where search_dialog is the dialog to be
positioned and user_data is
data.gtk.TreeView.set_rubber_bandingset_rubber_bandingenableenable :if True enable rubber
bandingThis method is available in PyGTK 2.10 and above.Enables or disables rubber banding. If the selection mode is
gtk.SELECTION_MULTIPLE, rubber banding will allow
the user to select multiple rows by dragging the mouse.gtk.TreeView.get_rubber_bandingget_rubber_bandingReturns :True if rubber banding is
enabled.This method is available in PyGTK 2.10 and above.Returns whether rubber banding is enabled. If the selection
mode is gtk.SELECTION_MULTIPLE, rubber banding will
allow the user to select multiple rows by dragging the mouse.gtk.TreeView.get_grid_linesget_grid_linesReturns :one of the
indicating which grid lines are enabled.This method is available in PyGTK 2.10 and above.Returns which grid lines are enabled.gtk.TreeView.set_grid_linesset_grid_linesgrid_linesgrid_lines :one of the
indicating which grid lines to enable.This method is available in PyGTK 2.10 and above.Sets which grid lines to draw.gtk.TreeView.get_enable_tree_linesget_enable_tree_linesReturns :True if tree lines are
drawn.This method is available in PyGTK 2.10 and above.Returns True if tree lines are drawn.gtk.TreeView.set_enable_tree_linesset_enable_tree_linesenabledenabled :if True enable tree line
drawing.This method is available in PyGTK 2.10 and above.Sets whether to draw lines interconnecting the expanders. This
does not have any visible effects for lists.gtk.TreeView.convert_widget_to_bin_window_coordsconvert_widget_to_bin_window_coordswidget_xwidget_ywidget_x :X coordinate relative to the widget.widget_y :Y coordinate relative to the widget.Returns :A tuple containing the bin_window X and Y coordinates.This method is available in PyGTK 2.12 and above.
Converts widget coordinates to coordinates for the bin_window (see get_bin_window).
gtk.TreeView.convert_widget_to_tree_coordsconvert_widget_to_tree_coordswidget_xwidget_ywidget_x :X coordinate relative to the widget.widget_y :Y coordinate relative to the widget.Returns :A tuple containing the tree X and Y coordinates.This method is available in PyGTK 2.12 and above.
Converts widget coordinates to coordinates for the tree (the full scrollable area of the tree).
gtk.TreeView.convert_tree_to_widget_coordsconvert_tree_to_widget_coordstree_xtree_ytree_x :X coordinate relative to the tree.tree_y :Y coordinate relative to the tree.Returns :A tuple containing the widget X and Y coordinates.This method is available in PyGTK 2.12 and above.
Converts tree coordinates (coordinates in full scrollable area of the tree) to widget coordinates.
gtk.TreeView.convert_tree_to_bin_window_coordsconvert_tree_to_bin_window_coordstree_xtree_ytree_x :X coordinate relative to the tree.tree_y :Y coordinate relative to the tree.Returns :A tuple containing the bin window X and Y coordinates.This method is available in PyGTK 2.12 and above.
Converts tree coordinates (coordinates in full scrollable area of the tree) to bin_window coordinates.
gtk.TreeView.convert_bin_window_to_widget_coordsconvert_bin_window_to_widget_coordswindow_xwindow_ywindow_x :X coordinate relative to the bin window.window_y :Y coordinate relative to the bin window.Returns :A tuple containing the widget X and Y coordinates.This method is available in PyGTK 2.12 and above.
Converts bin window coordinates (see get_bin_window)
to widget relative coordinates.
gtk.TreeView.convert_bin_window_to_tree_coordsconvert_bin_window_to_tree_coordswindow_xwindow_ywindow_x :X coordinate relative to the bin window.window_y :Y coordinate relative to the bin window.Returns :A tuple containing the tree X and Y coordinates.This method is available in PyGTK 2.12 and above.
Converts bin window coordinates (see get_bin_window)
to the tree (the full scrollable area of the tree).
gtk.TreeView.get_level_indentationget_level_indentationReturns :the amount of extra indentation for child levels in tree_view.
A return value of 0 means that this feature is disabled.This method is available in PyGTK 2.12 and above.
Returns the amount, in pixels, of extra indentation for child levels in tree_view.
gtk.TreeView.set_level_indentationset_level_indentationindentationindentation :the amount, in pixels, of extra indentation in tree_view.This method is available in PyGTK 2.12 and above.
Sets the amount of extra indentation for child levels to use in tree_view
in addition to the default indentation. The value should be specified in pixels,
a value of 0 disables this feature and in this case only the default indentation
will be used. This does not have any visible effects for lists.
gtk.TreeView.get_show_expandersget_show_expandersReturns :True if expanders are drawn
in tree_view, False otherwise.This method is available in PyGTK 2.12 and above.
Returns whether or not expanders are drawn in tree_view.
gtk.TreeView.set_show_expandersset_show_expandersenabledindentation :True to enable expander drawing, False otherwise.This method is available in PyGTK 2.12 and above.
Sets whether to draw and enable expanders and indent child rows in tree_view.
When disabled there will be no expanders visible in trees and there will be
no way to expand and collapse rows by default. Also note that hiding the expanders
will disable the default indentation. You can set a custom indentation in this case using
gtk_tree_view_set_level_indentation().
This does not have any visible effects for lists.
gtk.TreeView.get_tooltip_columnget_tooltip_columnReturns :the index of the tooltip column that is currently
being used, or -1 if this is disabled.This method is available in PyGTK 2.12 and above.
Returns the column of tree_view's model which is being used for
displaying tooltips on tree_view's rows.
gtk.TreeView.set_tooltip_columnset_tooltip_columncolumncolumn :an integer, which is a valid column number
for tree_view's modelThis method is available in PyGTK 2.12 and above.
If you only plan to have simple (text-only) tooltips on full rows, you can
use this function to have GtkTreeView handle these automatically for you.
column should be set to the column in tree_view's model containing the
tooltip texts, or -1 to disable this feature.
When enabled, GtkWidget::has-tooltip will be set to True
and tree_view will connect a GtkWidget::query-tooltip signal handler.
gtk.TreeView.is_rubber_banding_activeis_rubber_banding_activeReturns :True if a rubber banding
operation is currently being done in tree_view.This method is available in PyGTK 2.12 and above.
Returns whether a rubber banding operation is currently being done in tree_view.
gtk.TreeView.set_tooltip_cellset_tooltip_celltooltippathcolumncelltooltip :a gtk.Tooltip.
path :a tree path or None.column :a gtk.TreeViewColumn
or None.cell :a gtk.CellRenderer
or None.This method is available in PyGTK 2.12 and above.
Sets the tip area of tooltip to the area path, column and cell have in common.
For example if path is None and column is set, the tip
area will be set to the full area covered by column.
gtk.TreeView.set_tooltip_rowset_tooltip_rowtooltippathtooltip :a gtk.Tooltip.
path :a tree path.This method is available in PyGTK 2.12 and above.
Sets the tip area of tooltip to be the area covered by the row at path.
SignalsThe "columns-changed" gtk.TreeView Signalcallbacktreeviewuser_param1...treeview :the treeview that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "columns-changed" signal is emitted when a column has been
added to, removed from or moved in treeview.The "cursor-changed" gtk.TreeView Signalcallbacktreeviewuser_param1...treeview :the treeview that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "cursor-changed" signal is emitted when the cursor moves or
is set.The "expand-collapse-cursor-row" gtk.TreeView Signalcallbacktreeviewlogicalexpandopen_alluser_param1...treeview :the treeview that received the
signallogical :if Trueexpand :if True the row should be
expandedopen_all :if True recursively expand
all childrenuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the signal was
handled.The "expand-collapse-cursor-row" signal is emitted when the row
at the cursor needs to be expanded or collapsed.The "move-cursor" gtk.TreeView Signalcallbacktreeviewstepcountuser_param1...treeview :the treeview that received the
signalstep :the movement step sizecount :the number of steps to
takeuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the signal was
handled.The "move-cursor" signal is emitted when the user moves the
cursor using the Right, Left,
Up or Down arrow keys or the
Page Up, Page Down, Home
and End keys.The "row-activated" gtk.TreeView Signalcallbacktreeviewpathview_columnuser_param1...treeview :the treeview that received the
signalpath :the path of the activated
rowview_column :the column in the activated
rowuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "row-activated" signal is emitted when the row_activated()
method is called or the user double clicks a treeview
row. "row-activated" is also emitted when a non-editable row is selected and
one of the keys: Space, ShiftSpace,
Return or Enter is pressed.The "row-collapsed" gtk.TreeView Signalcallbacktreeviewiterpathuser_param1...treeview :the treeview that received the
signaliter :a gtk.TreeIter
pointing to the row that collapsedpath :the path of the row that
collapseduser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "row-collapsed" signal is emitted when a row is collapsed by
user of programmatic action.The "row-expanded" gtk.TreeView Signalcallbacktreeviewiterpathuser_param1...treeview :the treeview that received the
signaliter :a gtk.TreeIter
pointing to the row that expandedpath :the path of the row that
expandeduser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "row-expanded" signal is emitted when a row is expanded via
user or programmatic action.The "select-all" gtk.TreeView Signalcallbacktreeviewuser_param1...treeview :the treeview that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the signal was
handled.The "select-all" signal is emitted when the user presses
Controla or Control/.The "select-cursor-parent" gtk.TreeView Signalcallbacktreeviewuser_param1...treeview :the treeview that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the signal was
handled.The "select-cursor-parent" signal is emitted when the user
presses Backspace while
a row has the cursor.The "select-cursor-row" gtk.TreeView Signalcallbacktreeviewstart_editinguser_param1...treeview :the treeview that received the
signalstart_editing :if True the cell editing is
starteduser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the signal was
handled.The "select-cursor-row" signal is emitted when a non-editable
row is selected and one of the keys: Space, ShiftSpace,
Return or Enter is pressed.The "set-scroll-adjustments" gtk.TreeView Signalcallbacktreeviewhadjustmentvadjustmentuser_param1...treeview :the treeview that received the
signalhadjustment :a horizontal gtk.Adjustmentvadjustment :a vertical gtk.Adjustmentuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the signal was
handled.The "set-scroll-adjustments" signal is emitted when new
horizontal or vertical adjustments are set on the
treeview.The "start-interactive-search" gtk.TreeView Signalcallbacktreeviewuser_param1...treeview :the treeview that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the signal was
handled.The "start-interactive-search" signal is emitted when the user
presses Controlf.The "test-collapse-row" gtk.TreeView Signalcallbacktreeviewiterpathuser_param1...treeview :the treeview that received the
signaliter :the gtk.TreeIter
pointing at the row to test.path :the path of the row to be
testeduser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the row should be
collapsed.The "test-collapse-row" signal is emitted when the row pointed
to by iter and path is to be
collapsed.The "test-expand-row" gtk.TreeView Signalcallbacktreeviewiterpathuser_param1...treeview :the treeview that received the
signaliter :the gtk.TreeIter
pointing at the row to test.path :the path of the row to
testuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the row should be
expanded.The "test-expand-row" signal is emitted when the row pointed to
by iter and path is to be
expanded.The "toggle-cursor-row" gtk.TreeView Signalcallbacktreeviewuser_param1...treeview :the treeview that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the signal was
handled.The "toggle-cursor-row" signal is emitted when the user presses
ControlSpace.The "unselect-all" gtk.TreeView Signalcallbacktreeviewuser_param1...treeview :the treeview that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)Returns :True if the signal was
handled.The "unselect-all" signal is emitted when the user presses
ShiftControla or ShiftControl/.