Gtk.TreeView


Gtk.TreeView — A widget for displaying both trees and lists

Object Hierarchy:

    GObject
    ╰── GInitiallyUnowned
        ╰── Gtk.Widget
            ╰── Gtk.Container
                ╰── Gtk.TreeView

See also:

Gtk.TreeViewColumn, Gtk.TreeSelection, Gtk.TreeModel, [Gtk.TreeView drag-and-drop][gtk3-Gtk.TreeView-drag-and-drop], Gtk.TreeSortable, Gtk.TreeModelSort, Gtk.ListStore, Gtk.TreeStore, Gtk.CellRenderer, Gtk.CellEditable, Gtk.CellRendererPixbuf, Gtk.CellRendererText, Gtk.CellRendererToggle


Functions:


Signals:

  • “columns-changed” (tree_view, user_data)
  • “cursor-changed” (tree_view, user_data)
  • “expand-collapse-cursor-row” (treeview, user_data)
  • “move-cursor” (tree_view, step, direction, user_data)
  • “row-activated” (tree_view, path, column, user_data)
  • “row-collapsed” (tree_view, iter, path, user_data)
  • “row-expanded” (tree_view, iter, path, user_data)
  • “select-all” (treeview, user_data)
  • “select-cursor-parent” (treeview, user_data)
  • “select-cursor-row” (treeview, user_data)
  • “start-interactive-search” (treeview, user_data)
  • “test-collapse-row” (tree_view, iter, path, user_data)
  • “test-expand-row” (tree_view, iter, path, user_data)
  • “toggle-cursor-row” (treeview, user_data)

Description:

Widget that displays any object that implements the Gtk.TreeModel interface.

Please refer to the [tree widget conceptual overview][TreeWidget] for an overview of all the objects and data types related to the tree widget and how they work together.

Several different coordinate systems are exposed in the Gtk.TreeView API.

![](tree-view-coordinates.png)

Coordinate systems in Gtk.TreeView API:

  • Widget coordinates: Coordinates relative to the widget (usually widget-\>window).

  • Bin window coordinates: Coordinates relative to the window that Gtk.TreeView renders to. These coordinates start at (0, 0) for row 0 of the tree.

Several functions are available for converting between the different coordinate systems. The most common translations are between widget and bin window coordinates and between bin window and tree coordinates. For the former you can use Gtk.TreeView::convert_widget_to_bin_window_coords() (and vice versa), for the latter Gtk.TreeView::convert_bin_window_to_tree_coords() (and vice versa).

Gtk.TreeView as Gtk.Buildable:

The Gtk.TreeView implementation of the Gtk.Buildable interface accepts Gtk.TreeViewColumn objects as <child> elements and exposes the internal Gtk.TreeSelection in UI definitions.

An example of a UI definition fragment with Gtk.TreeView:

<object class="GtkTreeView" id="treeview">
  <property name="model">liststore1</property>
  <child>
    <object class="GtkTreeViewColumn" id="test-column">
      <property name="title">Test</property>
      <child>
        <object class="GtkCellRendererText" id="test-renderer"/>
        <attributes>
          <attribute name="text">1</attribute>
        </attributes>
      </child>
    </object>
  </child>
  <child internal-child="selection">
    <object class="GtkTreeSelection" id="selection">
      <signal name="changed" handler="on_treeview_selection_changed"/>
    </object>
  </child>
</object>

Function Details:

new()

new () -> Gtk.Widget

Creates a new Gtk.TreeView widget.

  • Returns: A newly created Gtk.TreeView widget.

get_level_indentation()

get_level_indentation (self) -> int

Returns the amount, in pixels, of extra indentation for child levelsin tree_view.

  • Returns: the amount of extra indentation for child levels intree_view. A return value of 0 means that this feature is disabled.

  • Since: 2.12


get_show_expanders()

get_show_expanders (self) -> bool

Returns whether or not expanders are drawn in tree_view.

  • Returns: True if expanders are drawn in tree_view, FALSEotherwise.

  • Since: 2.12


set_level_indentation()

set_level_indentation (self, indentation:int)

Sets the amount of extra indentation for child levels to use in tree_viewin addition to the default indentation. The value should be specified inpixels, a value of 0 disables this feature and in this case only the defaultindentation will be used.This does not have any visible effects for lists.

  • Since: 2.12

set_show_expanders()

set_show_expanders (self, enabled:bool)

Sets whether to draw and enable expanders and indent child rows intree_view. When disabled there will be no expanders visible in treesand there will be no way to expand and collapse rows by default. Alsonote that hiding the expanders will disable the default indentation. Youcan set a custom indentation in this case usingGtk.TreeView:set_level_indentation().This does not have any visible effects for lists.

  • Since: 2.12

new_with_model()

new_with_model (model:Gtk.TreeModel) -> Gtk.Widget

Creates a new Gtk.TreeView widget with the model initialized to model.

  • Returns: A newly created Gtk.TreeView widget.

get_model()

get_model (self) -> Gtk.TreeModel or None

Returns the model the Gtk.TreeView is based on. Returns None if themodel is unset.

  • Returns: A Gtk.TreeModel, or None ifnone is currently being used.

set_model()

set_model (self, model:Gtk.TreeModel=None)

Sets the model for a Gtk.TreeView. If the tree_view already has a modelset, it will remove it before setting the new model. If model is None,then it will unset the old model.


get_selection()

get_selection (self) -> Gtk.TreeSelection

Gets the Gtk.TreeSelection associated with tree_view.

  • Returns: A Gtk.TreeSelection object.

get_hadjustment()

get_hadjustment (self) -> Gtk.Adjustment

Gtk.TreeView:get_hadjustment has been deprecated since version 3.0 and should not be used in newly-written code. Use `Gtk.Scrollable:get_hadjustment()Gets theGtk.Adjustment` currently being used for the horizontal aspect.

  • Returns: A Gtk.Adjustment object, or Noneif none is currently being used.

set_hadjustment()

set_hadjustment (self, adjustment:Gtk.Adjustment=None)

Gtk.TreeView:set_hadjustment has been deprecated since version 3.0 and should not be used in newly-written code. Use `Gtk.Scrollable:set_hadjustment()Sets theGtk.Adjustment` for the current horizontal aspect.


get_vadjustment()

get_vadjustment (self) -> Gtk.Adjustment

Gtk.TreeView:get_vadjustment has been deprecated since version 3.0 and should not be used in newly-written code. Use `Gtk.Scrollable:get_vadjustment()Gets theGtk.Adjustment` currently being used for the vertical aspect.

  • Returns: A Gtk.Adjustment object, or Noneif none is currently being used.

set_vadjustment()

set_vadjustment (self, adjustment:Gtk.Adjustment=None)

Gtk.TreeView:set_vadjustment has been deprecated since version 3.0 and should not be used in newly-written code. Use `Gtk.Scrollable:set_vadjustment()Sets theGtk.Adjustment` for the current vertical aspect.


get_headers_visible()

get_headers_visible (self) -> bool

Returns True if the headers on the tree_view are visible.

  • Returns: Whether the headers are visible or not.

set_headers_visible()

set_headers_visible (self, headers_visible:bool)

Sets the visibility state of the headers.


columns_autosize()

columns_autosize (self)

Resizes all columns to their optimal width. Only works after thetreeview has been realized.


get_headers_clickable()

get_headers_clickable (self) -> bool

Returns whether all header columns are clickable.

  • Returns: True if all header columns are clickable, otherwise FALSE

  • Since: 2.10


set_headers_clickable()

set_headers_clickable (self, setting:bool)

Allow the column title buttons to be clicked.


set_rules_hint()

set_rules_hint (self, setting:bool)

Gtk.TreeView:set_rules_hint has been deprecated since version 3.14 and should not be used in newly-written code. Sets a hint for the theme to draw even/odd rows in the tree_viewwith different colors, also known as "zebra striping". This function tells the GTK+ theme that the user interface for yourapplication requires users to read across tree rows and associatecells with one another. Do not use it just because you prefer the appearance of the ruledtree; that’s a question for the theme. Some themes will draw treerows in alternating colors even when rules are turned off, andusers who prefer that appearance all the time can choose thosethemes. You should call this function only as a semantic hint tothe theme engine that your tree makes alternating colors usefulfrom a functional standpoint (since it has lots of columns,generally).


get_rules_hint()

get_rules_hint (self) -> bool

Gtk.TreeView:get_rules_hint has been deprecated since version 3.14 and should not be used in newly-written code. Gets the setting set by Gtk.TreeView:set_rules_hint().

  • Returns: True if the hint is set

set_activate_on_single_click()

set_activate_on_single_click (self, single:bool)

Cause the “row-activated” signal to be emittedon a single click instead of a double click.

  • Since: 3.8

get_activate_on_single_click()

get_activate_on_single_click (self) -> bool

Gets the setting set by Gtk.TreeView:set_activate_on_single_click().

  • Returns: True if row-activated will be emitted on a single click

  • Since: 3.8


append_column()

append_column (self, column:Gtk.TreeViewColumn) -> int

Appends column to the list of columns. If tree_view has “fixed_height”mode enabled, then column must have its “sizing” property set to beGTK_TREE_VIEW_COLUMN_FIXED.

  • Returns: The number of columns in tree_viewafter appending.

remove_column()

remove_column (self, column:Gtk.TreeViewColumn) -> int

Removes column from tree_view.

  • Returns: The number of columns in tree_viewafter removing.

insert_column()

insert_column (self, column:Gtk.TreeViewColumn, position:int) -> int

This inserts the column into the tree_view at position. If position is-1, then the column is inserted at the end. If tree_view has“fixed_height” mode enabled, then column must have its “sizing” propertyset to be GTK_TREE_VIEW_COLUMN_FIXED.

  • Returns: The number of columns in tree_viewafter insertion.

insert_column_with_data_func()

insert_column_with_data_func (self, position:int, title:str, cell:Gtk.CellRenderer, func:Gtk.TreeCellDataFunc, data=None) -> int

Convenience function that inserts a new column into the Gtk.TreeViewwith the given cell renderer and a Gtk.TreeCellDataFunc to set cell rendererattributes (normally using data from the model). See alsoGtk.TreeView:column_set_cell_data_func(), Gtk.TreeView:column_pack_start().If tree_view has “fixed_height” mode enabled, then the new column will have its“sizing” property set to be GTK_TREE_VIEW_COLUMN_FIXED.

  • Returns: number of columns in the tree view post-insert

get_n_columns()

get_n_columns (self) -> int

Queries the number of columns in the given tree_view.

  • Returns: The number of columns in the tree_view

  • Since: 3.4


get_column()

get_column (self, n:int) -> Gtk.TreeViewColumn

Gets the Gtk.TreeViewColumn at the given position in the tree_view.

  • Returns: The Gtk.TreeViewColumn, or None if theposition is outside the range of columns.

get_columns()

get_columns (self) -> list

Returns a GList of all the Gtk.TreeViewColumn s currently in tree_view.The returned list must be freed with g_list_free().

  • Returns: A list of Gtk.TreeViewColumn s.

move_column_after()

move_column_after (self, column:Gtk.TreeViewColumn, base_column:Gtk.TreeViewColumn=None)

Moves column to be after to base_column. If base_column is None, thencolumn is placed in the first position.


set_expander_column()

set_expander_column (self, column:Gtk.TreeViewColumn)

Sets the column to draw the expander arrow at. It must be in tree_view. If column is None, then the expander arrow is always at the first visible column. If you do not want expander arrow to appear in your tree, set the expander column to a hidden column.


get_expander_column()

get_expander_column (self) -> Gtk.TreeViewColumn

Returns the column that is the current expander column.This column has the expander arrow drawn next to it.

  • Returns: The expander column.

set_column_drag_function()

set_column_drag_function (self, func:Gtk.TreeViewColumnDropFunc=None, user_data=None)

Sets a user function for determining where a column may be dropped whendragged. This function is called on every column pair in turn at thebeginning of a column drag to determine where a drop can take place. Thearguments passed to func are: the tree_view, the Gtk.TreeViewColumn beingdragged, the two Gtk.TreeViewColumn s determining the drop spot, anduser_data. If either of the Gtk.TreeViewColumn arguments for the drop spotare None, then they indicate an edge. If func is set to be None, thentree_view reverts to the default behavior of allowing all columns to bedropped everywhere.


scroll_to_point()

scroll_to_point (self, tree_x:int, tree_y:int)

Scrolls the tree view such that the top-left corner of the visiblearea is tree_x, tree_y, where tree_x and tree_y are specifiedin tree coordinates. The tree_view must be realized beforethis function is called. If it isn't, you probably want to beusing Gtk.TreeView:scroll_to_cell(). If either tree_x or tree_y are -1, then that direction isn’t scrolled.


scroll_to_cell()

scroll_to_cell (self, path:Gtk.TreePath=None, column:Gtk.TreeViewColumn=None, use_align:bool, row_align:float, col_align:float)

Moves the alignments of tree_view to the position specified by column andpath. If column is None, then no horizontal scrolling occurs. Likewise,if path is None no vertical scrolling occurs. At a minimum, one of columnor path need to be non-None. row_align determines where the row isplaced, and col_align determines where column is placed. Both are expectedto be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 meansright/bottom alignment, 0.5 means center. If use_align is FALSE, then the alignment arguments are ignored, and thetree 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 its currentposition. If the cell is currently visible on the screen, nothing is done. This function only works if the model is set, and path is a valid row on themodel. If the model changes before the tree_view is realized, the centeredpath will be modified to reflect this change.


set_cursor()

set_cursor (self, path:Gtk.TreePath, focus_column:Gtk.TreeViewColumn=None, start_editing:bool)

Sets the current keyboard focus to be at path, and selects it. This isuseful when you want to focus the user’s attention on a particular row. Iffocus_column is not None, then focus is given to the column specified by it. Additionally, if focus_column is specified, and start_editing is True, then editing should be started in the specified cell. This function is often followed by Gtk.Widget:grab_focus (tree_view) in order to give keyboard focus to the widget. Please note that editing can only happen when the widget is realized. If path is invalid for model, the current cursor (if any) will be unsetand the function will return without failing.


set_cursor_on_cell()

set_cursor_on_cell (self, path:Gtk.TreePath, focus_column:Gtk.TreeViewColumn=None, focus_cell:Gtk.CellRenderer=None, start_editing:bool)

Sets the current keyboard focus to be at path, and selects it. This isuseful when you want to focus the user’s attention on a particular row. Iffocus_column is not None, then focus is given to the column specified byit. If focus_column and focus_cell are not None, and focus_columncontains 2 or more editable or activatable cells, then focus is given tothe cell specified by focus_cell. Additionally, if focus_column isspecified, and start_editing is True, then editing should be started inthe specified cell. This function is often followed byGtk.Widget:grab_focus (tree_view) in order to give keyboard focus to thewidget. Please note that editing can only happen when the widget isrealized. If path is invalid for model, the current cursor (if any) will be unsetand the function will return without failing.

  • Since: 2.2

get_cursor()

get_cursor (self) -> path:Gtk.TreePath, focus_column:Gtk.TreeViewColumn

Fills in path and focus_column with the current path and focus column. Ifthe cursor isn’t currently set, then path will be None. If no columncurrently has focus, then focus_column will be None. The returned Gtk.TreePath must be freed with `Gtk.TreePath:free()` whenyou are done with it.


row_activated()

row_activated (self, path:Gtk.TreePath, column:Gtk.TreeViewColumn)

Activates the cell determined by path and column.


expand_all()

expand_all (self)

Recursively expands all nodes in the tree_view.


collapse_all()

collapse_all (self)

Recursively collapses all visible, expanded nodes in tree_view.


expand_to_path()

expand_to_path (self, path:Gtk.TreePath)

Expands the row at path. This will also expand all parent rows ofpath as necessary.

  • Since: 2.2

expand_row()

expand_row (self, path:Gtk.TreePath, open_all:bool) -> bool

Opens the row so its children are visible.

  • Returns: True if the row existed and had children

collapse_row()

collapse_row (self, path:Gtk.TreePath) -> bool

Collapses a row (hides its child rows, if they exist).

  • Returns: True if the row was collapsed.

map_expanded_rows()

map_expanded_rows (self, func:Gtk.TreeViewMappingFunc, data=None)

Calls func on all expanded rows.


row_expanded()

row_expanded (self, path:Gtk.TreePath) -> bool

Returns True if the node pointed to by path is expanded in tree_view.

  • Returns: True if path is expanded.

set_reorderable()

set_reorderable (self, reorderable:bool)

This function is a convenience function to allow you to reordermodels that support the Gtk.TreeDragSourceIface and theGtk.TreeDragDestIface. Both Gtk.TreeStore and Gtk.ListStore supportthese. If reorderable is True, then the user can reorder themodel by dragging and dropping rows. The developer can listen tothese changes by connecting to the model’s “row-inserted”and “row-deleted” signals. The reordering is implementedby setting up the tree view as a drag source and destination.Therefore, drag and drop can not be used in a reorderable view for anyother purpose. This function does not give you any degree of control over the order -- anyreordering is allowed. If more control is needed, you should probablyhandle drag and drop manually.


get_reorderable()

get_reorderable (self) -> bool

Retrieves whether the user can reorder the tree via drag-and-drop. SeeGtk.TreeView:set_reorderable().

  • Returns: True if the tree can be reordered.

is_blank_at_pos()

is_blank_at_pos (self, x:int, y:int) -> bool, path:Gtk.TreePath, column:Gtk.TreeViewColumn, cell_x:int, cell_y:int

Determine whether the point (x, y) in tree_view is blank, that is nocell content nor an expander arrow is drawn at the location. If so, thelocation can be considered as the background. You might wish to takespecial action on clicks on the background, such as clearing a currentselection, having a custom context menu or starting rubber banding. The x and y coordinate that are provided must be relative to bin_windowcoordinates. That is, x and y must come from an event on tree_viewwhere event-&gt;window ==Gtk.TreeView:get_bin_window()`. For converting widget coordinates (eg. the ones you get fromGtk.Widget::query-tooltip), please seeGtk.TreeView:convert_widget_to_bin_window_coords(). Thepath,column,cell_xandcell_yarguments will be filled inlikewise as forGtk.TreeView:get_path_at_pos(). Please seeGtk.TreeView:get_path_at_pos()` for more information.

  • Returns: True if the area at the given coordinates is blank,FALSE otherwise.

  • Since: 3.0


get_cell_area()

get_cell_area (self, path:Gtk.TreePath=None, column:Gtk.TreeViewColumn=None) -> rect:Gdk.Rectangle

Fills the bounding rectangle in bin_window coordinates for the cell at therow specified by path and the column specified by column. If path isNone, or points to a path not currently displayed, the y and height fieldsof the rectangle will be filled with 0. If column is None, the x and widthfields will be filled with 0. The sum of all cell rects does not cover theentire tree; there are extra pixels in between rows, for example. Thereturned rectangle is equivalent to the cell_area passed to`Gtk.CellRenderer:render(). This function is only valid iftree_view` isrealized.


get_background_area()

get_background_area (self, path:Gtk.TreePath=None, column:Gtk.TreeViewColumn=None) -> rect:Gdk.Rectangle

Fills the bounding rectangle in bin_window coordinates for the cell at therow specified by path and the column specified by column. If path isNone, or points to a node not found in the tree, the y and height fields ofthe rectangle will be filled with 0. If column is None, the x and widthfields will be filled with 0. The returned rectangle is equivalent to thebackground_area passed to `Gtk.CellRenderer:render(). These backgroundareas tile to cover the entire bin window. Contrast with thecell_area,returned byGtk.TreeView:get_cell_area()`, which returns only the cellitself, excluding surrounding borders and the tree expander area.


get_visible_rect()

get_visible_rect (self) -> visible_rect:Gdk.Rectangle

Fills visible_rect with the currently-visible region of thebuffer, in tree coordinates. Convert to bin_window coordinates withGtk.TreeView:convert_tree_to_bin_window_coords().Tree coordinates start at 0,0 for row 0 of the tree, and cover the entirescrollable area of the tree.


get_bin_window()

get_bin_window (self) -> Gdk.Window

Returns the window that tree_view renders to.This is used primarily to compare to event-&gt;windowto confirm that the event on tree_view is on the right window.

  • Returns: A GdkWindow, or None when tree_viewhasn’t been realized yet.

convert_bin_window_to_tree_coords()

convert_bin_window_to_tree_coords (self, bx:int, by:int) -> tx:int, ty:int

Converts bin_window coordinates to coordinates for thetree (the full scrollable area of the tree).

  • Since: 2.12

convert_bin_window_to_widget_coords()

convert_bin_window_to_widget_coords (self, bx:int, by:int) -> wx:int, wy:int

Converts bin_window coordinates (see Gtk.TreeView:get_bin_window())to widget relative coordinates.

  • Since: 2.12

convert_tree_to_bin_window_coords()

convert_tree_to_bin_window_coords (self, tx:int, ty:int) -> bx:int, by:int

Converts tree coordinates (coordinates in full scrollable area of the tree)to bin_window coordinates.

  • Since: 2.12

convert_tree_to_widget_coords()

convert_tree_to_widget_coords (self, tx:int, ty:int) -> wx:int, wy:int

Converts tree coordinates (coordinates in full scrollable area of the tree)to widget coordinates.

  • Since: 2.12

convert_widget_to_bin_window_coords()

convert_widget_to_bin_window_coords (self, wx:int, wy:int) -> bx:int, by:int

Converts widget coordinates to coordinates for the bin_window(see Gtk.TreeView:get_bin_window()).

  • Since: 2.12

convert_widget_to_tree_coords()

convert_widget_to_tree_coords (self, wx:int, wy:int) -> tx:int, ty:int

Converts widget coordinates to coordinates for thetree (the full scrollable area of the tree).

  • Since: 2.12

enable_model_drag_dest()

enable_model_drag_dest (self, targets:list, actions:Gdk.DragAction)

Turns tree_view into a drop destination for automatic DND. Callingthis method sets “reorderable” to FALSE.


enable_model_drag_source()

enable_model_drag_source (self, start_button_mask:Gdk.ModifierType, targets:list, actions:Gdk.DragAction)

Turns tree_view into a drag source for automatic DND. Calling thismethod sets “reorderable” to FALSE.


unset_rows_drag_source()

unset_rows_drag_source (self)

Undoes the effect ofGtk.TreeView:enable_model_drag_source(). Calling this method sets“reorderable” to FALSE.


unset_rows_drag_dest()

unset_rows_drag_dest (self)

Undoes the effect ofGtk.TreeView:enable_model_drag_dest(). Calling this method sets“reorderable” to FALSE.


set_drag_dest_row()

set_drag_dest_row (self, path:Gtk.TreePath=None, pos:Gtk.TreeViewDropPosition)

Sets the row that is highlighted for feedback.If path is None, an existing highlight is removed.


get_drag_dest_row()

get_drag_dest_row (self) -> path:Gtk.TreePath, pos:Gtk.TreeViewDropPosition

Gets information about the row that is highlighted for feedback.


create_row_drag_icon()

create_row_drag_icon (self, path:Gtk.TreePath) -> cairo.Surface

Creates a cairo_surface_t representation of the row at path. This image is used for a drag icon.

  • Returns: a newly-allocated surface of the drag icon.

set_enable_search()

set_enable_search (self, enable_search:bool)

If enable_search is set, then the user can type in text to search throughthe tree interactively (this is sometimes called "typeahead find"). Note that even if this is FALSE, the user can still initiate a search using the “start-interactive-search” key binding.


get_enable_search()

get_enable_search (self) -> bool

Returns whether or not the tree allows to start interactive searching by typing in text.

  • Returns: whether or not to let the user search interactively

get_search_column()

get_search_column (self) -> int

Gets the column searched on by the interactive search code.

  • Returns: the column the interactive search code searches in.

set_search_column()

set_search_column (self, column:int)

Sets column as the column where the interactive search code shouldsearch in for the current model. If the search column is set, users can use the “start-interactive-search”key binding to bring up search popup. The enable-search property controlswhether simply typing text will also start an interactive search. Note that column refers to a column of the current model. The search column is reset to -1 when the model is changed.


set_search_equal_func()

set_search_equal_func (self, search_equal_func:Gtk.TreeViewSearchEqualFunc, search_user_data=None)

Sets the compare function for the interactive search capabilities; notethat somewhat like strcmp() returning 0 for equalityGtk.TreeViewSearchEqualFunc returns FALSE on matches.


get_search_entry()

get_search_entry (self) -> Gtk.Entry

Returns the Gtk.Entry which is currently in use as interactive searchentry for tree_view. In case the built-in entry is being used, Nonewill be returned.

  • Returns: the entry currently in use as search entry.

  • Since: 2.10


set_search_entry()

set_search_entry (self, entry:Gtk.Entry=None)

Sets the entry which the interactive search code will use for thistree_view. This is useful when you want to provide a search entryin our interface at all time at a fixed position. Passing None forentry will make the interactive search code use the built-in popupentry again.

  • Since: 2.10

set_search_position_func()

set_search_position_func (self, func:Gtk.TreeViewSearchPositionFunc=None, data=None)

Sets the function to use when positioning the search dialog.

  • Since: 2.10

get_fixed_height_mode()

get_fixed_height_mode (self) -> bool

Returns whether fixed height mode is turned on for tree_view.

  • Returns: True if tree_viewis in fixed height mode

  • Since: 2.6


set_fixed_height_mode()

set_fixed_height_mode (self, enable:bool)

Enables or disables the fixed height mode of tree_view. Fixed height mode speeds up Gtk.TreeView by assuming that all rows have the same height. Only enable this option if all rows are the same height and allcolumns are of type GTK_TREE_VIEW_COLUMN_FIXED.

  • Since: 2.6

get_hover_selection()

get_hover_selection (self) -> bool

Returns whether hover selection mode is turned on for tree_view.

  • Returns: True if tree_viewis in hover selection mode

  • Since: 2.6


set_hover_selection()

set_hover_selection (self, hover:bool)

Enables or disables the hover selection mode of tree_view.Hover selection makes the selected row follow the pointer.Currently, this works only for the selection modes GTK_SELECTION_SINGLE and GTK_SELECTION_BROWSE.

  • Since: 2.6

get_hover_expand()

get_hover_expand (self) -> bool

Returns whether hover expansion mode is turned on for tree_view.

  • Returns: True if tree_viewis in hover expansion mode

  • Since: 2.6


set_hover_expand()

set_hover_expand (self, expand:bool)

Enables or disables the hover expansion mode of tree_view.Hover expansion makes rows expand or collapse if the pointer moves over them.

  • Since: 2.6

set_destroy_count_func()

set_destroy_count_func (self, func:Gtk.TreeDestroyCountFunc=None, data=None)

Gtk.TreeView:set_destroy_count_func has been deprecated since version 3.4 and should not be used in newly-written code. Accessibility does not need the function anymore. This function should almost never be used. It is meant for private use byATK for determining the number of visible children that are removed when theuser collapses a row, or a row is deleted.


set_row_separator_func()

set_row_separator_func (self, func:Gtk.TreeViewRowSeparatorFunc=None, data=None)

Sets the row separator function, which is used to determinewhether a row should be drawn as a separator. If the row separatorfunction is None, no separators are drawn. This is the default value.

  • Since: 2.6

get_rubber_banding()

get_rubber_banding (self) -> bool

Returns whether rubber banding is turned on for tree_view. If theselection mode is GTK_SELECTION_MULTIPLE, rubber banding will allow theuser to select multiple rows by dragging the mouse.

  • Returns: True if rubber banding in tree_viewis enabled.

  • Since: 2.10


set_rubber_banding()

set_rubber_banding (self, enable:bool)

Enables or disables rubber banding in tree_view. If the selection modeis GTK_SELECTION_MULTIPLE, rubber banding will allow the user to selectmultiple rows by dragging the mouse.

  • Since: 2.10

is_rubber_banding_active()

is_rubber_banding_active (self) -> bool

Returns whether a rubber banding operation is currently being donein tree_view.

  • Returns: True if a rubber banding operation is currently beingdone in tree_view.

  • Since: 2.12


get_enable_tree_lines()

get_enable_tree_lines (self) -> bool

Returns whether or not tree lines are drawn in tree_view.

  • Returns: True if tree lines are drawn in tree_view, FALSEotherwise.

  • Since: 2.10


set_enable_tree_lines()

set_enable_tree_lines (self, enabled:bool)

Sets whether to draw lines interconnecting the expanders in tree_view.This does not have any visible effects for lists.

  • Since: 2.10

get_grid_lines()

get_grid_lines (self) -> Gtk.TreeViewGridLines

Returns which grid lines are enabled in tree_view.

  • Returns: a Gtk.TreeViewGridLines value indicating which grid linesare enabled.

  • Since: 2.10


set_grid_lines()

set_grid_lines (self, grid_lines:Gtk.TreeViewGridLines)

Sets which grid lines to draw in tree_view.

  • Since: 2.10

set_tooltip_row()

set_tooltip_row (self, tooltip:Gtk.Tooltip, path:Gtk.TreePath)

Sets the tip area of tooltip to be the area covered by the row at path.See also Gtk.TreeView:set_tooltip_column() for a simpler alternative.See also `Gtk.Tooltip:set_tip_area()`.

  • Since: 2.12

set_tooltip_cell()

set_tooltip_cell (self, tooltip:Gtk.Tooltip, path:Gtk.TreePath=None, column:Gtk.TreeViewColumn=None, cell:Gtk.CellRenderer=None)

Sets the tip area of tooltip to the area path, column and cell havein common. For example if path is None and column is set, the tiparea will be set to the full area covered by column. See also`Gtk.Tooltip:set_tip_area(). Note that ifpathis not specified andcellis set and part of a columncontaining the expander, the tooltip might not show and hide at the correctposition. In such casespathmust be set to the current node under themouse cursor for this function to operate correctly. See alsoGtk.TreeView:set_tooltip_column()` for a simpler alternative.

  • Since: 2.12

get_tooltip_context()

get_tooltip_context (self, x:int, y:int, keyboard_tip:bool) -> bool, x:int, y:int, model:Gtk.TreeModel, path:Gtk.TreePath, iter:Gtk.TreeIter

This function is supposed to be used in a “query-tooltip”signal handler for Gtk.TreeView. The x, y and keyboard_tip valueswhich are received in the signal handler, should be passed to thisfunction without modification. The return value indicates whether there is a tree view row at the givencoordinates (True) or not (FALSE) for mouse tooltips. For keyboardtooltips the row returned will be the cursor row. When True, then any ofmodel, path and iter which have been provided will be set to point tothat row and the corresponding model. x and y will always be convertedto be relative to tree_view’s bin_window if keyboard_tooltip is FALSE.

  • Returns: whether or not the given tooltip context points to a row.

  • Since: 2.12


get_tooltip_column()

get_tooltip_column (self) -> int

Returns the column of tree_view’s model which is being used fordisplaying tooltips on tree_view’s rows.

  • Returns: the index of the tooltip column that is currently beingused, or -1 if this is disabled.

  • Since: 2.12


set_tooltip_column()

set_tooltip_column (self, column:int)

If you only plan to have simple (text-only) tooltips on full rows, youcan use this function to have Gtk.TreeView handle these automaticallyfor you. column should be set to the column in tree_view’s modelcontaining the tooltip texts, or -1 to disable this feature. When enabled, “has-tooltip” will be set to True andtree_view will connect a “query-tooltip” signal handler. Note that the signal handler sets the text with `Gtk.Tooltip:set_markup()`,so &, <, etc have to be escaped in the text.

  • Since: 2.12

results matching ""

    No results matching ""