Gtk.TreeView

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.Scrollable Gtk.Scrollable GObject.GInterface->Gtk.Scrollable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.TreeView Gtk.TreeView Gtk.Container->Gtk.TreeView Gtk.Scrollable->Gtk.TreeView Gtk.Widget->Gtk.Container

Example

../_images/TreeView.png
Subclasses:

None

Methods

Inherited:

Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Scrollable (9)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new ()

class

new_with_model (model)

append_column (column)

collapse_all ()

collapse_row (path)

columns_autosize ()

convert_bin_window_to_tree_coords (bx, by)

convert_bin_window_to_widget_coords (bx, by)

convert_tree_to_bin_window_coords (tx, ty)

convert_tree_to_widget_coords (tx, ty)

convert_widget_to_bin_window_coords (wx, wy)

convert_widget_to_tree_coords (wx, wy)

create_row_drag_icon (path)

enable_model_drag_dest (targets, actions)

enable_model_drag_source (start_button_mask, targets, actions)

expand_all ()

expand_row (path, open_all)

expand_to_path (path)

get_activate_on_single_click ()

get_background_area (path, column)

get_bin_window ()

get_cell_area (path, column)

get_column (n)

get_columns ()

get_cursor ()

get_dest_row_at_pos (drag_x, drag_y)

get_drag_dest_row ()

get_enable_search ()

get_enable_tree_lines ()

get_expander_column ()

get_fixed_height_mode ()

get_grid_lines ()

get_hadjustment ()

get_headers_clickable ()

get_headers_visible ()

get_hover_expand ()

get_hover_selection ()

get_level_indentation ()

get_model ()

get_n_columns ()

get_path_at_pos (x, y)

get_reorderable ()

get_rubber_banding ()

get_rules_hint ()

get_search_column ()

get_search_entry ()

get_selection ()

get_show_expanders ()

get_tooltip_column ()

get_tooltip_context (x, y, keyboard_tip)

get_vadjustment ()

get_visible_range ()

get_visible_rect ()

insert_column (column, position)

insert_column_with_attributes (position, title, cell, **kwargs)

insert_column_with_data_func (position, title, cell, func, *data)

is_blank_at_pos (x, y)

is_rubber_banding_active ()

map_expanded_rows (func, *data)

move_column_after (column, base_column)

remove_column (column)

row_activated (path, column)

row_expanded (path)

scroll_to_cell (path, column, use_align, row_align, col_align)

scroll_to_point (tree_x, tree_y)

set_activate_on_single_click (single)

set_column_drag_function (func, *user_data)

set_cursor (path, focus_column, start_editing)

set_cursor_on_cell (path, focus_column, focus_cell, start_editing)

set_destroy_count_func (func, *data)

set_drag_dest_row (path, pos)

set_enable_search (enable_search)

set_enable_tree_lines (enabled)

set_expander_column (column)

set_fixed_height_mode (enable)

set_grid_lines (grid_lines)

set_hadjustment (adjustment)

set_headers_clickable (setting)

set_headers_visible (headers_visible)

set_hover_expand (expand)

set_hover_selection (hover)

set_level_indentation (indentation)

set_model (model)

set_reorderable (reorderable)

set_row_separator_func (func, *data)

set_rubber_banding (enable)

set_rules_hint (setting)

set_search_column (column)

set_search_entry (entry)

set_search_equal_func (search_equal_func, *search_user_data)

set_search_position_func (func, *data)

set_show_expanders (enabled)

set_tooltip_cell (tooltip, path, column, cell)

set_tooltip_column (column)

set_tooltip_row (tooltip, path)

set_vadjustment (adjustment)

unset_rows_drag_dest ()

unset_rows_drag_source ()

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Scrollable (1)

do_columns_changed ()

do_cursor_changed ()

do_expand_collapse_cursor_row (logical, expand, open_all)

do_move_cursor (step, count)

do_row_activated (path, column)

do_row_collapsed (iter, path)

do_row_expanded (iter, path)

do_select_all ()

do_select_cursor_parent ()

do_select_cursor_row (start_editing)

do_start_interactive_search ()

do_test_collapse_row (iter, path)

do_test_expand_row (iter, path)

do_toggle_cursor_row ()

do_unselect_all ()

Properties

Inherited:

Gtk.Container (3), Gtk.Widget (39), Gtk.Scrollable (4)

Name

Type

Flags

Short Description

activate-on-single-click

bool

r/w/en

Activate row on a single click

enable-grid-lines

Gtk.TreeViewGridLines

r/w/en

Whether grid lines should be drawn in the tree view

enable-search

bool

r/w/en

View allows user to search through columns interactively

enable-tree-lines

bool

r/w/en

Whether tree lines should be drawn in the tree view

expander-column

Gtk.TreeViewColumn

r/w

Set the column for the expander column

fixed-height-mode

bool

r/w/en

Speeds up Gtk.TreeView by assuming that all rows have the same height

headers-clickable

bool

r/w/en

Column headers respond to click events

headers-visible

bool

r/w/en

Show the column header buttons

hover-expand

bool

r/w/en

Whether rows should be expanded/collapsed when the pointer moves over them

hover-selection

bool

r/w/en

Whether the selection should follow the pointer

level-indentation

int

r/w/en

Extra indentation for each level

model

Gtk.TreeModel

r/w

The model for the tree view

reorderable

bool

r/w/en

View is reorderable

rubber-banding

bool

r/w/en

Whether to enable selection of multiple items by dragging the mouse pointer

rules-hint

bool

d/r/w/en

Set a hint to the theme engine to draw rows in alternating colors deprecated

search-column

int

r/w/en

Model column to search through during interactive search

show-expanders

bool

r/w/en

View has expanders

tooltip-column

int

r/w/en

The column in the model containing the tooltip texts for the rows

Style Properties

Inherited:

Gtk.Widget (17)

Name

Type

Default

Flags

Short Description

allow-rules

bool

True

r

Allow drawing of alternating color rows

even-row-color

Gdk.Color

None

r

Color to use for even rows

expander-size

int

14

r

Size of the expander arrow

grid-line-pattern

str

'\x01\x01'

r

Dash pattern used to draw the tree view grid lines

grid-line-width

int

1

r

Width, in pixels, of the tree view grid lines

horizontal-separator

int

2

r

Horizontal space between cells. Must be an even number

indent-expanders

bool

True

r

Make the expanders indented

odd-row-color

Gdk.Color

None

r

Color to use for odd rows

tree-line-pattern

str

'\x01\x01'

r

Dash pattern used to draw the tree view lines

tree-line-width

int

1

r

Width, in pixels, of the tree view lines

vertical-separator

int

2

r

Vertical space between cells. Must be an even number

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Short Description

columns-changed

The number of columns of the treeview has changed.

cursor-changed

The position of the cursor (focused cell) has changed.

expand-collapse-cursor-row

move-cursor

The Gtk.TreeView ::move-cursor signal is a keybinding signal which gets emitted when the user presses one of the cursor keys.

row-activated

The “row-activated” signal is emitted when the method Gtk.TreeView.row_activated() is called, when the user double clicks a treeview row with the “activate-on-single-click” property set to False, or when the user single clicks a row when the “activate-on-single-click” property set to True.

row-collapsed

The given row has been collapsed (child nodes are hidden).

row-expanded

The given row has been expanded (child nodes are shown).

select-all

select-cursor-parent

select-cursor-row

start-interactive-search

test-collapse-row

The given row is about to be collapsed (hide its children nodes).

test-expand-row

The given row is about to be expanded (show its children nodes).

toggle-cursor-row

unselect-all

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Type

Access

Description

parent

Gtk.Container

r

Class Details

class Gtk.TreeView(*args, **kwargs)
Bases:

Gtk.Container, Gtk.Scrollable

Abstract:

No

Structure:

Gtk.TreeViewClass

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

Please refer to the tree widget conceptual overview 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. These are:

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.

  • Tree coordinates: Coordinates relative to the entire scrollable area of Gtk.TreeView. 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>
CSS nodes
treeview.view
├── header
│   ├── <column header>
┊   ┊
│   ╰── <column header>
│
╰── [rubberband]

Gtk.TreeView has a main CSS node with name treeview and style class .view. It has a subnode with name header, which is the parent for all the column header widgets’ CSS nodes. For rubberband selection, a subnode with name rubberband is used.

classmethod new()[source]
Returns:

A newly created Gtk.TreeView widget.

Return type:

Gtk.Widget

Creates a new Gtk.TreeView widget.

classmethod new_with_model(model)[source]
Parameters:

model (Gtk.TreeModel) – the model.

Returns:

A newly created Gtk.TreeView widget.

Return type:

Gtk.Widget

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

append_column(column)[source]
Parameters:

column (Gtk.TreeViewColumn) – The Gtk.TreeViewColumn to add.

Returns:

The number of columns in self after appending.

Return type:

int

Appends column to the list of columns. If self has “fixed_height” mode enabled, then column must have its “sizing” property set to be Gtk.TreeViewColumnSizing.FIXED.

collapse_all()[source]

Recursively collapses all visible, expanded nodes in self.

collapse_row(path)[source]
Parameters:

path (Gtk.TreePath) – path to a row in the self

Returns:

True if the row was collapsed.

Return type:

bool

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

columns_autosize()[source]

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

convert_bin_window_to_tree_coords(bx, by)[source]
Parameters:
  • bx (int) – X coordinate relative to bin_window

  • by (int) – Y coordinate relative to bin_window

Returns:

tx:

return location for tree X coordinate

ty:

return location for tree Y coordinate

Return type:

(tx: int, ty: int)

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

New in version 2.12.

convert_bin_window_to_widget_coords(bx, by)[source]
Parameters:
  • bx (int) – bin_window X coordinate

  • by (int) – bin_window Y coordinate

Returns:

wx:

return location for widget X coordinate

wy:

return location for widget Y coordinate

Return type:

(wx: int, wy: int)

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

New in version 2.12.

convert_tree_to_bin_window_coords(tx, ty)[source]
Parameters:
  • tx (int) – tree X coordinate

  • ty (int) – tree Y coordinate

Returns:

bx:

return location for X coordinate relative to bin_window

by:

return location for Y coordinate relative to bin_window

Return type:

(bx: int, by: int)

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

New in version 2.12.

convert_tree_to_widget_coords(tx, ty)[source]
Parameters:
  • tx (int) – X coordinate relative to the tree

  • ty (int) – Y coordinate relative to the tree

Returns:

wx:

return location for widget X coordinate

wy:

return location for widget Y coordinate

Return type:

(wx: int, wy: int)

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

New in version 2.12.

convert_widget_to_bin_window_coords(wx, wy)[source]
Parameters:
  • wx (int) – X coordinate relative to the widget

  • wy (int) – Y coordinate relative to the widget

Returns:

bx:

return location for bin_window X coordinate

by:

return location for bin_window Y coordinate

Return type:

(bx: int, by: int)

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

New in version 2.12.

convert_widget_to_tree_coords(wx, wy)[source]
Parameters:
  • wx (int) – X coordinate relative to the widget

  • wy (int) – Y coordinate relative to the widget

Returns:

tx:

return location for tree X coordinate

ty:

return location for tree Y coordinate

Return type:

(tx: int, ty: int)

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

New in version 2.12.

create_row_drag_icon(path)[source]
Parameters:

path (Gtk.TreePath) – a Gtk.TreePath in self

Returns:

a newly-allocated surface of the drag icon.

Return type:

cairo.Surface

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

enable_model_drag_dest(targets, actions)[source]
Parameters:
  • targets ([Gtk.TargetEntry]) – the table of targets that the drag will support

  • actions (Gdk.DragAction) – the bitmask of possible actions for a drag from this widget

Turns self into a drop destination for automatic DND. Calling this method sets Gtk.TreeView :reorderable to False.

enable_model_drag_source(start_button_mask, targets, actions)[source]
Parameters:
  • start_button_mask (Gdk.ModifierType) – Mask of allowed buttons to start drag

  • targets ([Gtk.TargetEntry]) – the table of targets that the drag will support

  • actions (Gdk.DragAction) – the bitmask of possible actions for a drag from this widget

Turns self into a drag source for automatic DND. Calling this method sets Gtk.TreeView :reorderable to False.

expand_all()[source]

Recursively expands all nodes in the self.

expand_row(path, open_all)[source]
Parameters:
  • path (Gtk.TreePath) – path to a row

  • open_all (bool) – whether to recursively expand, or just expand immediate children

Returns:

True if the row existed and had children

Return type:

bool

Opens the row so its children are visible.

expand_to_path(path)[source]
Parameters:

path (Gtk.TreePath) – path to a row.

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

New in version 2.2.

get_activate_on_single_click()[source]
Returns:

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

Return type:

bool

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

New in version 3.8.

get_background_area(path, column)[source]
Parameters:
Returns:

rectangle to fill with cell background rect

Return type:

rect: Gdk.Rectangle

Fills the bounding rectangle in bin_window coordinates for the cell at the row specified by path and the column specified by column. If path is None, or points to a node not found in the tree, the y and height fields of the rectangle will be filled with 0. If column is None, the x and width fields will be filled with 0. The returned rectangle is equivalent to the background_area passed to Gtk.CellRenderer.render(). These background areas tile to cover the entire bin window. Contrast with the cell_area, returned by Gtk.TreeView.get_cell_area(), which returns only the cell itself, excluding surrounding borders and the tree expander area.

get_bin_window()[source]
Returns:

A Gdk.Window, or None when self hasn’t been realized yet.

Return type:

Gdk.Window or None

Returns the window that self renders to. This is used primarily to compare to event->window to confirm that the event on self is on the right window.

get_cell_area(path, column)[source]
Parameters:
Returns:

rectangle to fill with cell rect

Return type:

rect: Gdk.Rectangle

Fills the bounding rectangle in bin_window coordinates for the cell at the row specified by path and the column specified by column. If path is None, or points to a path not currently displayed, the y and height fields of the rectangle will be filled with 0. If column is None, the x and width fields will be filled with 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 Gtk.CellRenderer.render(). This function is only valid if self is realized.

get_column(n)[source]
Parameters:

n (int) – The position of the column, counting from 0.

Returns:

The Gtk.TreeViewColumn, or None if the position is outside the range of columns.

Return type:

Gtk.TreeViewColumn or None

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

get_columns()[source]
Returns:

A list of Gtk.TreeViewColumn s

Return type:

[Gtk.TreeViewColumn]

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

get_cursor()[source]
Returns:

path:

A pointer to be filled with the current cursor path, or None

focus_column:

A pointer to be filled with the current focus column, or None

Return type:

(path: Gtk.TreePath or None, focus_column: Gtk.TreeViewColumn or None)

Fills in path and focus_column with the current path and focus column. If the cursor isn’t currently set, then path will be None. If no column currently has focus, then focus_column will be None.

The returned Gtk.TreePath must be freed with Gtk.TreePath.free() when you are done with it.

get_dest_row_at_pos(drag_x, drag_y)[source]
Parameters:
  • drag_x (int) – the position to determine the destination row for

  • drag_y (int) – the position to determine the destination row for

Returns:

None if there is no row at the given position or a tuple containing:

path:

the path of the highlighted row

pos:

the drop position

Return type:

(path: Gtk.TreePath or None, pos: Gtk.TreeViewDropPosition) or None

Determines the destination row for a given position. drag_x and drag_y are expected to be in widget coordinates. This function is only meaningful if self is realized. Therefore this function will always return None if self is not realized or does not have a model.

get_drag_dest_row()[source]
Returns:

path:

Return location for the path of the highlighted row, or None.

pos:

Return location for the drop position, or None

Return type:

(path: Gtk.TreePath or None, pos: Gtk.TreeViewDropPosition)

Gets information about the row that is highlighted for feedback.

Returns:

whether or not to let the user search interactively

Return type:

bool

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

get_enable_tree_lines()[source]
Returns:

True if tree lines are drawn in self, False otherwise.

Return type:

bool

Returns whether or not tree lines are drawn in self.

New in version 2.10.

get_expander_column()[source]
Returns:

The expander column.

Return type:

Gtk.TreeViewColumn

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

get_fixed_height_mode()[source]
Returns:

True if self is in fixed height mode

Return type:

bool

Returns whether fixed height mode is turned on for self.

New in version 2.6.

get_grid_lines()[source]
Returns:

a Gtk.TreeViewGridLines value indicating which grid lines are enabled.

Return type:

Gtk.TreeViewGridLines

Returns which grid lines are enabled in self.

New in version 2.10.

get_hadjustment()[source]
Returns:

A Gtk.Adjustment object, or None if none is currently being used.

Return type:

Gtk.Adjustment

Gets the Gtk.Adjustment currently being used for the horizontal aspect.

Deprecated since version 3.0: Use Gtk.Scrollable.get_hadjustment()

get_headers_clickable()[source]
Returns:

True if all header columns are clickable, otherwise False

Return type:

bool

Returns whether all header columns are clickable.

New in version 2.10.

get_headers_visible()[source]
Returns:

Whether the headers are visible or not.

Return type:

bool

Returns True if the headers on the self are visible.

get_hover_expand()[source]
Returns:

True if self is in hover expansion mode

Return type:

bool

Returns whether hover expansion mode is turned on for self.

New in version 2.6.

get_hover_selection()[source]
Returns:

True if self is in hover selection mode

Return type:

bool

Returns whether hover selection mode is turned on for self.

New in version 2.6.

get_level_indentation()[source]
Returns:

the amount of extra indentation for child levels in self. A return value of 0 means that this feature is disabled.

Return type:

int

Returns the amount, in pixels, of extra indentation for child levels in self.

New in version 2.12.

get_model()[source]
Returns:

A Gtk.TreeModel, or None if none is currently being used.

Return type:

Gtk.TreeModel or None

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

get_n_columns()[source]
Returns:

The number of columns in the self

Return type:

int

Queries the number of columns in the given self.

New in version 3.4.

get_path_at_pos(x, y)[source]
Parameters:
  • x (int) – The x position to be identified (relative to bin_window).

  • y (int) – The y position to be identified (relative to bin_window).

Returns:

None if the row doesn’t exist at that coordinates or a tuple containing:

path:

a Gtk.TreePath

column:

a Gtk.TreeViewColumn

cell_x:

the X coordinate relative to the cell

cell_y:

the Y coordinate relative to the cell

Return type:

(path: Gtk.TreePath or None, column: Gtk.TreeViewColumn or None, cell_x: int, cell_y: int) or None

Finds the path at the point (x, y), relative to bin_window coordinates (please see Gtk.TreeView.get_bin_window()). That is, x and y are relative to an events coordinates. x and y must come from an event on the self only where event->window == gtk_tree_view_get_bin_window (). It is primarily for things like popup menus. If path is non-None, then it will be filled with the Gtk.TreePath at that point. This path should be freed with Gtk.TreePath.free(). If column is non-None, then it will be filled with the column at that point. cell_x and cell_y return the coordinates relative to the cell background (i.e. the background_area passed to Gtk.CellRenderer.render()). This function is only meaningful if self is realized. Therefore this function will always return False if self is not realized or does not have a model.

For converting widget coordinates (eg. the ones you get from Gtk.Widget ::query-tooltip), please see Gtk.TreeView.convert_widget_to_bin_window_coords().

get_reorderable()[source]
Returns:

True if the tree can be reordered.

Return type:

bool

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

get_rubber_banding()[source]
Returns:

True if rubber banding in self is enabled.

Return type:

bool

Returns whether rubber banding is turned on for self. If the selection mode is Gtk.SelectionMode.MULTIPLE, rubber banding will allow the user to select multiple rows by dragging the mouse.

New in version 2.10.

get_rules_hint()[source]
Returns:

True if the hint is set

Return type:

bool

Gets the setting set by Gtk.TreeView.set_rules_hint().

Deprecated since version 3.14.

get_search_column()[source]
Returns:

the column the interactive search code searches in.

Return type:

int

Gets the column searched on by the interactive search code.

get_search_entry()[source]
Returns:

the entry currently in use as search entry.

Return type:

Gtk.Entry

Returns the Gtk.Entry which is currently in use as interactive search entry for self. In case the built-in entry is being used, None will be returned.

New in version 2.10.

get_selection()[source]
Returns:

A Gtk.TreeSelection object.

Return type:

Gtk.TreeSelection

Gets the Gtk.TreeSelection associated with self.

get_show_expanders()[source]
Returns:

True if expanders are drawn in self, False otherwise.

Return type:

bool

Returns whether or not expanders are drawn in self.

New in version 2.12.

get_tooltip_column()[source]
Returns:

the index of the tooltip column that is currently being used, or -1 if this is disabled.

Return type:

int

Returns the column of self’s model which is being used for displaying tooltips on self’s rows.

New in version 2.12.

get_tooltip_context(x, y, keyboard_tip)[source]
Parameters:
  • x (int) – the x coordinate (relative to widget coordinates)

  • y (int) – the y coordinate (relative to widget coordinates)

  • keyboard_tip (bool) – whether this is a keyboard tooltip or not

Returns:

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

x:

the x coordinate (relative to widget coordinates)

y:

the y coordinate (relative to widget coordinates)

model:

a pointer to receive a Gtk.TreeModel or None

path:

a pointer to receive a Gtk.TreePath or None

iter:

a pointer to receive a Gtk.TreeIter or None

Return type:

(bool, x: int, y: int, model: Gtk.TreeModel or None, path: Gtk.TreePath, iter: Gtk.TreeIter)

This function is supposed to be used in a Gtk.Widget ::query-tooltip signal handler for Gtk.TreeView. The x, y and keyboard_tip values which are received in the signal handler, should be passed to this function without modification.

The return value indicates whether there is a tree view row at the given coordinates (True) or not (False) for mouse tooltips. For keyboard tooltips the row returned will be the cursor row. When True, then any of model, path and iter which have been provided will be set to point to that row and the corresponding model. x and y will always be converted to be relative to self’s bin_window if keyboard_tooltip is False.

New in version 2.12.

get_vadjustment()[source]
Returns:

A Gtk.Adjustment object, or None if none is currently being used.

Return type:

Gtk.Adjustment

Gets the Gtk.Adjustment currently being used for the vertical aspect.

Deprecated since version 3.0: Use Gtk.Scrollable.get_vadjustment()

get_visible_range()[source]
Returns:

Either None if there is no visible range or a tuple containing:

start_path:

start of region

end_path:

end of region

Return type:

(start_path: Gtk.TreePath, end_path: Gtk.TreePath) or None

Returns the first and last visible path. Note that there may be invisible paths in between.

New in version 2.8.

get_visible_rect()[source]
Returns:

rectangle to fill

Return type:

visible_rect: Gdk.Rectangle

Fills visible_rect with the currently-visible region of the buffer, in tree coordinates. Convert to bin_window coordinates with Gtk.TreeView.convert_tree_to_bin_window_coords(). Tree coordinates start at 0,0 for row 0 of the tree, and cover the entire scrollable area of the tree.

insert_column(column, position)[source]
Parameters:
Returns:

The number of columns in self after insertion.

Return type:

int

This inserts the column into the self at position. If position is -1, then the column is inserted at the end. If self has “fixed_height” mode enabled, then column must have its “sizing” property set to be Gtk.TreeViewColumnSizing.FIXED.

insert_column_with_attributes(position, title, cell, **kwargs)[source]
Parameters:

Creates a new Gtk.TreeViewColumn and inserts it into the self at position. If position is -1, then the newly created column is inserted at the end. The column is initialized with the attributes given. If self has “fixed_height” mode enabled, then the new column will have its sizing property set to be Gtk.TreeViewColumnSizing.FIXED.

insert_column_with_data_func(position, title, cell, func, *data)[source]
Parameters:
Returns:

number of columns in the tree view post-insert

Return type:

int

Convenience function that inserts a new column into the Gtk.TreeView with the given cell renderer and a Gtk.TreeCellDataFunc to set cell renderer attributes (normally using data from the model). See also Gtk.TreeViewColumn.set_cell_data_func(), Gtk.TreeViewColumn.pack_start(). If self has “fixed_height” mode enabled, then the new column will have its “sizing” property set to be Gtk.TreeViewColumnSizing.FIXED.

is_blank_at_pos(x, y)[source]
Parameters:
  • x (int) – The x position to be identified (relative to bin_window)

  • y (int) – The y position to be identified (relative to bin_window)

Returns:

True if the area at the given coordinates is blank, False otherwise.

path:

A pointer to a Gtk.TreePath pointer to be filled in, or None

column:

A pointer to a Gtk.TreeViewColumn pointer to be filled in, or None

cell_x:

A pointer where the X coordinate relative to the cell can be placed, or None

cell_y:

A pointer where the Y coordinate relative to the cell can be placed, or None

Return type:

(bool, path: Gtk.TreePath or None, column: Gtk.TreeViewColumn or None, cell_x: int, cell_y: int)

Determine whether the point (x, y) in self is blank, that is no cell content nor an expander arrow is drawn at the location. If so, the location can be considered as the background. You might wish to take special action on clicks on the background, such as clearing a current selection, having a custom context menu or starting rubber banding.

The x and y coordinate that are provided must be relative to bin_window coordinates. That is, x and y must come from an event on self where event->window == gtk_tree_view_get_bin_window ().

For converting widget coordinates (eg. the ones you get from Gtk.Widget ::query-tooltip), please see Gtk.TreeView.convert_widget_to_bin_window_coords().

The path, column, cell_x and cell_y arguments will be filled in likewise as for Gtk.TreeView.get_path_at_pos(). Please see Gtk.TreeView.get_path_at_pos() for more information.

New in version 3.0.

is_rubber_banding_active()[source]
Returns:

True if a rubber banding operation is currently being done in self.

Return type:

bool

Returns whether a rubber banding operation is currently being done in self.

New in version 2.12.

map_expanded_rows(func, *data)[source]
Parameters:

Calls func on all expanded rows.

move_column_after(column, base_column)[source]
Parameters:

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

remove_column(column)[source]
Parameters:

column (Gtk.TreeViewColumn) – The Gtk.TreeViewColumn to remove.

Returns:

The number of columns in self after removing.

Return type:

int

Removes column from self.

row_activated(path, column)[source]
Parameters:

Activates the cell determined by path and column.

row_expanded(path)[source]
Parameters:

path (Gtk.TreePath) – A Gtk.TreePath to test expansion state.

Returns:

True if #path is expanded.

Return type:

bool

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

scroll_to_cell(path, column, use_align, row_align, col_align)[source]
Parameters:

Moves the alignments of self to the position specified by column and path. If column is None, then no horizontal scrolling occurs. Likewise, if path is None no vertical scrolling occurs. At a minimum, one of column or path need to be non-None. row_align determines where the row is placed, and col_align determines where column is placed. Both are expected to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means right/bottom alignment, 0.5 means center.

If use_align is False, then 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 its current position. 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 the model. If the model changes before the self is realized, the centered path will be modified to reflect this change.

scroll_to_point(tree_x, tree_y)[source]
Parameters:
  • tree_x (int) – X coordinate of new top-left pixel of visible area, or -1

  • tree_y (int) – Y coordinate of new top-left pixel of visible area, or -1

Scrolls the tree view such that the top-left corner of the visible area is tree_x, tree_y, where tree_x and tree_y are specified in tree coordinates. The self must be realized before this function is called. If it isn’t, you probably want to be using Gtk.TreeView.scroll_to_cell().

If either tree_x or tree_y are -1, then that direction isn’t scrolled.

set_activate_on_single_click(single)[source]
Parameters:

single (bool) – True to emit row-activated on a single click

Cause the Gtk.TreeView ::row-activated signal to be emitted on a single click instead of a double click.

New in version 3.8.

set_column_drag_function(func, *user_data)[source]
Parameters:

Sets a user function for determining where a column may be dropped when dragged. This 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 arguments passed to func are: the self, the Gtk.TreeViewColumn being dragged, the two Gtk.TreeViewColumn s determining the drop spot, and user_data. If either of the Gtk.TreeViewColumn arguments for the drop spot are None, then they indicate an edge. If func is set to be None, then self reverts to the default behavior of allowing all columns to be dropped everywhere.

set_cursor(path, focus_column, start_editing)[source]
Parameters:

Sets the current keyboard focus to be at path, and selects it. This is useful when you want to focus the user’s attention on a particular row. If focus_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 (self) 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 unset and the function will return without failing.

set_cursor_on_cell(path, focus_column, focus_cell, start_editing)[source]
Parameters:

Sets the current keyboard focus to be at path, and selects it. This is useful when you want to focus the user’s attention on a particular row. If focus_column is not None, then focus is given to the column specified by it. If focus_column and focus_cell are not None, 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, then editing should be started in the specified cell. This function is often followed by gtk_widget_grab_focus (self) 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 unset and the function will return without failing.

New in version 2.2.

set_destroy_count_func(func, *data)[source]
Parameters:

This function should almost never be used. It is meant for private use by ATK for determining the number of visible children that are removed when the user collapses a row, or a row is deleted.

Deprecated since version 3.4: Accessibility does not need the function anymore.

set_drag_dest_row(path, pos)[source]
Parameters:

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

Parameters:

enable_search (bool) – True, if the user can search interactively

If enable_search is set, then the user can type in text to search through the 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.

set_enable_tree_lines(enabled)[source]
Parameters:

enabled (bool) – True to enable tree line drawing, False otherwise.

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

New in version 2.10.

set_expander_column(column)[source]
Parameters:

column (Gtk.TreeViewColumn or None) – None, or the column to draw the expander arrow at.

Sets the column to draw the expander arrow at. It must be in self. 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.

set_fixed_height_mode(enable)[source]
Parameters:

enable (bool) – True to enable fixed height mode

Enables or disables the fixed height mode of self. 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 all columns are of type Gtk.TreeViewColumnSizing.FIXED.

New in version 2.6.

set_grid_lines(grid_lines)[source]
Parameters:

grid_lines (Gtk.TreeViewGridLines) – a Gtk.TreeViewGridLines value indicating which grid lines to enable.

Sets which grid lines to draw in self.

New in version 2.10.

set_hadjustment(adjustment)[source]
Parameters:

adjustment (Gtk.Adjustment or None) – The Gtk.Adjustment to set, or None

Sets the Gtk.Adjustment for the current horizontal aspect.

Deprecated since version 3.0: Use Gtk.Scrollable.set_hadjustment()

set_headers_clickable(setting)[source]
Parameters:

setting (bool) – True if the columns are clickable.

Allow the column title buttons to be clicked.

set_headers_visible(headers_visible)[source]
Parameters:

headers_visible (bool) – True if the headers are visible

Sets the visibility state of the headers.

set_hover_expand(expand)[source]
Parameters:

expand (bool) – True to enable hover selection mode

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

New in version 2.6.

set_hover_selection(hover)[source]
Parameters:

hover (bool) – True to enable hover selection mode

Enables or disables the hover selection mode of self. Hover selection makes the selected row follow the pointer. Currently, this works only for the selection modes Gtk.SelectionMode.SINGLE and Gtk.SelectionMode.BROWSE.

New in version 2.6.

set_level_indentation(indentation)[source]
Parameters:

indentation (int) – the amount, in pixels, of extra indentation in self.

Sets the amount of extra indentation for child levels to use in self 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.

New in version 2.12.

set_model(model)[source]
Parameters:

model (Gtk.TreeModel or None) – The model.

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

set_reorderable(reorderable)[source]
Parameters:

reorderable (bool) – True, if the tree can be reordered.

This function is a convenience function to allow you to reorder models that support the Gtk.TreeDragSourceIface and the Gtk.TreeDragDestIface. 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 developer can listen to these changes by connecting to the model’s Gtk.TreeModel ::row-inserted and Gtk.TreeModel ::row-deleted signals. The reordering is implemented by setting up the tree view as a drag source and destination. Therefore, drag and drop can not be used in a reorderable view for any other purpose.

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.

set_row_separator_func(func, *data)[source]
Parameters:

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

New in version 2.6.

set_rubber_banding(enable)[source]
Parameters:

enable (bool) – True to enable rubber banding

Enables or disables rubber banding in self. If the selection mode is Gtk.SelectionMode.MULTIPLE, rubber banding will allow the user to select multiple rows by dragging the mouse.

New in version 2.10.

set_rules_hint(setting)[source]
Parameters:

setting (bool) – True if the tree requires reading across rows

Sets a hint for the theme to draw even/odd rows in the self with different colors, also known as “zebra striping”.

This function tells the GTK+ theme that the user interface for your application requires users to read across tree rows and associate cells with one another.

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 function 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).

Deprecated since version 3.14.

set_search_column(column)[source]
Parameters:

column (int) – the column of the model to search in, or -1 to disable searching

Sets column as the column where the interactive search code should search 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 controls whether 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_entry(entry)[source]
Parameters:

entry (Gtk.Entry or None) – the entry the interactive search code of self should use or None

Sets the entry which the interactive search code will use for this self. 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.

New in version 2.10.

set_search_equal_func(search_equal_func, *search_user_data)[source]
Parameters:

Sets the compare function for the interactive search capabilities; note that somewhat like strcmp() returning 0 for equality Gtk.TreeViewSearchEqualFunc returns False on matches.

set_search_position_func(func, *data)[source]
Parameters:

Sets the function to use when positioning the search dialog.

New in version 2.10.

set_show_expanders(enabled)[source]
Parameters:

enabled (bool) – True to enable expander drawing, False otherwise.

Sets whether to draw and enable expanders and indent child rows in self. 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.TreeView.set_level_indentation(). This does not have any visible effects for lists.

New in version 2.12.

set_tooltip_cell(tooltip, path, column, cell)[source]
Parameters:

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. See also Gtk.Tooltip.set_tip_area().

Note that if path is not specified and cell is set and part of a column containing the expander, the tooltip might not show and hide at the correct position. In such cases path must be set to the current node under the mouse cursor for this function to operate correctly.

See also Gtk.TreeView.set_tooltip_column() for a simpler alternative.

New in version 2.12.

set_tooltip_column(column)[source]
Parameters:

column (int) – an integer, which is a valid column number for self’s model

If you only plan to have simple (text-only) tooltips on full rows, you can use this function to have Gtk.TreeView handle these automatically for you. column should be set to the column in self’s model containing the tooltip texts, or -1 to disable this feature.

When enabled, Gtk.Widget :has-tooltip will be set to True and self will connect a Gtk.Widget ::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.

New in version 2.12.

set_tooltip_row(tooltip, path)[source]
Parameters:

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().

New in version 2.12.

set_vadjustment(adjustment)[source]
Parameters:

adjustment (Gtk.Adjustment or None) – The Gtk.Adjustment to set, or None

Sets the Gtk.Adjustment for the current vertical aspect.

Deprecated since version 3.0: Use Gtk.Scrollable.set_vadjustment()

unset_rows_drag_dest()[source]

Undoes the effect of Gtk.TreeView.enable_model_drag_dest(). Calling this method sets Gtk.TreeView :reorderable to False.

unset_rows_drag_source()[source]

Undoes the effect of Gtk.TreeView.enable_model_drag_source(). Calling this method sets Gtk.TreeView :reorderable to False.

do_columns_changed() virtual
do_cursor_changed() virtual
do_expand_collapse_cursor_row(logical, expand, open_all) virtual
Parameters:
Return type:

bool

do_move_cursor(step, count) virtual
Parameters:
Return type:

bool

do_row_activated(path, column) virtual
Parameters:

Activates the cell determined by path and column.

do_row_collapsed(iter, path) virtual
Parameters:
do_row_expanded(iter, path) virtual
Parameters:
do_select_all() virtual
Return type:

bool

do_select_cursor_parent() virtual
Return type:

bool

do_select_cursor_row(start_editing) virtual
Parameters:

start_editing (bool) –

Return type:

bool

Return type:

bool

do_test_collapse_row(iter, path) virtual
Parameters:
Return type:

bool

do_test_expand_row(iter, path) virtual
Parameters:
Return type:

bool

do_toggle_cursor_row() virtual
Return type:

bool

do_unselect_all() virtual
Return type:

bool

Signal Details

Gtk.TreeView.signals.columns_changed(tree_view)
Signal Name:

columns-changed

Flags:

RUN_LAST

Parameters:

tree_view (Gtk.TreeView) – The object which received the signal

The number of columns of the treeview has changed.

Gtk.TreeView.signals.cursor_changed(tree_view)
Signal Name:

cursor-changed

Flags:

RUN_LAST

Parameters:

tree_view (Gtk.TreeView) – The object which received the signal

The position of the cursor (focused cell) has changed.

Gtk.TreeView.signals.expand_collapse_cursor_row(tree_view, object, p0, p1)
Signal Name:

expand-collapse-cursor-row

Flags:

RUN_LAST, ACTION

Parameters:
Return type:

bool

Gtk.TreeView.signals.move_cursor(tree_view, step, direction)
Signal Name:

move-cursor

Flags:

RUN_LAST, ACTION

Parameters:
Returns:

True if step is supported, False otherwise.

Return type:

bool

The Gtk.TreeView ::move-cursor signal is a keybinding signal which gets emitted when the user presses one of the cursor keys.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically. In contrast to Gtk.TreeView.set_cursor() and Gtk.TreeView.set_cursor_on_cell() when moving horizontally Gtk.TreeView ::move-cursor does not reset the current selection.

Gtk.TreeView.signals.row_activated(tree_view, path, column)
Signal Name:

row-activated

Flags:

RUN_LAST, ACTION

Parameters:

The “row-activated” signal is emitted when the method Gtk.TreeView.row_activated() is called, when the user double clicks a treeview row with the “activate-on-single-click” property set to False, or when the user single clicks a row when the “activate-on-single-click” property set to True. It is also emitted when a non-editable row is selected and one of the keys: Space, Shift+Space, Return or Enter is pressed.

For selection handling refer to the tree widget conceptual overview as well as Gtk.TreeSelection.

Gtk.TreeView.signals.row_collapsed(tree_view, iter, path)
Signal Name:

row-collapsed

Flags:

RUN_LAST

Parameters:
  • tree_view (Gtk.TreeView) – The object which received the signal

  • iter (Gtk.TreeIter) – the tree iter of the collapsed row

  • path (Gtk.TreePath) – a tree path that points to the row

The given row has been collapsed (child nodes are hidden).

Gtk.TreeView.signals.row_expanded(tree_view, iter, path)
Signal Name:

row-expanded

Flags:

RUN_LAST

Parameters:
  • tree_view (Gtk.TreeView) – The object which received the signal

  • iter (Gtk.TreeIter) – the tree iter of the expanded row

  • path (Gtk.TreePath) – a tree path that points to the row

The given row has been expanded (child nodes are shown).

Gtk.TreeView.signals.select_all(tree_view)
Signal Name:

select-all

Flags:

RUN_LAST, ACTION

Parameters:

tree_view (Gtk.TreeView) – The object which received the signal

Return type:

bool

Gtk.TreeView.signals.select_cursor_parent(tree_view)
Signal Name:

select-cursor-parent

Flags:

RUN_LAST, ACTION

Parameters:

tree_view (Gtk.TreeView) – The object which received the signal

Return type:

bool

Gtk.TreeView.signals.select_cursor_row(tree_view, object)
Signal Name:

select-cursor-row

Flags:

RUN_LAST, ACTION

Parameters:
  • tree_view (Gtk.TreeView) – The object which received the signal

  • object (bool) –

Return type:

bool

Signal Name:

start-interactive-search

Flags:

RUN_LAST, ACTION

Parameters:

tree_view (Gtk.TreeView) – The object which received the signal

Return type:

bool

Gtk.TreeView.signals.test_collapse_row(tree_view, iter, path)
Signal Name:

test-collapse-row

Flags:

RUN_LAST

Parameters:
  • tree_view (Gtk.TreeView) – The object which received the signal

  • iter (Gtk.TreeIter) – the tree iter of the row to collapse

  • path (Gtk.TreePath) – a tree path that points to the row

Returns:

False to allow collapsing, True to reject

Return type:

bool

The given row is about to be collapsed (hide its children nodes). Use this signal if you need to control the collapsibility of individual rows.

Gtk.TreeView.signals.test_expand_row(tree_view, iter, path)
Signal Name:

test-expand-row

Flags:

RUN_LAST

Parameters:
  • tree_view (Gtk.TreeView) – The object which received the signal

  • iter (Gtk.TreeIter) – the tree iter of the row to expand

  • path (Gtk.TreePath) – a tree path that points to the row

Returns:

False to allow expansion, True to reject

Return type:

bool

The given row is about to be expanded (show its children nodes). Use this signal if you need to control the expandability of individual rows.

Gtk.TreeView.signals.toggle_cursor_row(tree_view)
Signal Name:

toggle-cursor-row

Flags:

RUN_LAST, ACTION

Parameters:

tree_view (Gtk.TreeView) – The object which received the signal

Return type:

bool

Gtk.TreeView.signals.unselect_all(tree_view)
Signal Name:

unselect-all

Flags:

RUN_LAST, ACTION

Parameters:

tree_view (Gtk.TreeView) – The object which received the signal

Return type:

bool

Property Details

Gtk.TreeView.props.activate_on_single_click
Name:

activate-on-single-click

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The activate-on-single-click property specifies whether the “row-activated” signal will be emitted after a single click.

New in version 3.8.

Gtk.TreeView.props.enable_grid_lines
Name:

enable-grid-lines

Type:

Gtk.TreeViewGridLines

Default Value:

Gtk.TreeViewGridLines.NONE

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether grid lines should be drawn in the tree view

Name:

enable-search

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

View allows user to search through columns interactively

Gtk.TreeView.props.enable_tree_lines
Name:

enable-tree-lines

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether tree lines should be drawn in the tree view

Gtk.TreeView.props.expander_column
Name:

expander-column

Type:

Gtk.TreeViewColumn

Default Value:

None

Flags:

READABLE, WRITABLE

Set the column for the expander column

Gtk.TreeView.props.fixed_height_mode
Name:

fixed-height-mode

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Setting the ::fixed-height-mode property to True speeds up Gtk.TreeView by assuming that all rows have the same height. Only enable this option if all rows are the same height. Please see Gtk.TreeView.set_fixed_height_mode() for more information on this option.

New in version 2.4.

Gtk.TreeView.props.headers_clickable
Name:

headers-clickable

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Column headers respond to click events

Gtk.TreeView.props.headers_visible
Name:

headers-visible

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Show the column header buttons

Gtk.TreeView.props.hover_expand
Name:

hover-expand

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Enables or disables the hover expansion mode of tree_view. Hover expansion makes 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.

New in version 2.6.

Gtk.TreeView.props.hover_selection
Name:

hover-selection

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.SelectionMode.SINGLE and Gtk.SelectionMode.BROWSE.

This mode is primarily intended for treeviews in popups, e.g. in Gtk.ComboBox or Gtk.EntryCompletion.

New in version 2.6.

Gtk.TreeView.props.level_indentation
Name:

level-indentation

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Extra indentation for each level.

New in version 2.12.

Gtk.TreeView.props.model
Name:

model

Type:

Gtk.TreeModel

Default Value:

None

Flags:

READABLE, WRITABLE

The model for the tree view

Gtk.TreeView.props.reorderable
Name:

reorderable

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

View is reorderable

Gtk.TreeView.props.rubber_banding
Name:

rubber-banding

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to enable selection of multiple items by dragging the mouse pointer

Gtk.TreeView.props.rules_hint
Name:

rules-hint

Type:

bool

Default Value:

False

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Sets a hint to the theme to draw rows in alternating colors.

Deprecated since version 3.14: The theme is responsible for drawing rows using zebra striping

Gtk.TreeView.props.search_column
Name:

search-column

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Model column to search through during interactive search

Gtk.TreeView.props.show_expanders
Name:

show-expanders

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

True if the view has expanders.

New in version 2.12.

Gtk.TreeView.props.tooltip_column
Name:

tooltip-column

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The column in the model containing the tooltip texts for the rows