Gtk.TreeViewColumn


Gtk.TreeViewColumn — A visible column in a Gtk.TreeView widget

Object Hierarchy:

    GObject
    ╰── GInitiallyUnowned
        ╰── Gtk.TreeViewColumn

See also:

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


Functions:

Description:

The Gtk.TreeViewColumn object represents a visible column in a GtkTreeView widget.

It allows to set properties of the column header, and functions as a holding pen for the cell renderers which determine how the data in the column is displayed.

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.


Function Details:

new()

new () -> Gtk.TreeViewColumn

Creates a new Gtk.TreeViewColumn.

  • Returns: A newly created Gtk.TreeViewColumn.

new_with_area()

new_with_area (area:Gtk.CellArea) -> Gtk.TreeViewColumn

Creates a new Gtk.TreeViewColumn using area to render its cells.

  • Returns: A newly created Gtk.TreeViewColumn.

  • Since: 3.0


pack_start()

pack_start (self, cell:Gtk.CellRenderer, expand:bool)

Packs the cell into the beginning of the column. If expand is FALSE, thenthe cell is allocated no more space than it needs. Any unused space is dividedevenly between cells for which expand is True.


pack_end()

pack_end (self, cell:Gtk.CellRenderer, expand:bool)

Adds the cell to end of the column. If expand is FALSE, then the cellis allocated no more space than it needs. Any unused space is dividedevenly between cells for which expand is True.


clear()

clear (self)

Unsets all the mappings on all renderers on the tree_column.


add_attribute()

add_attribute (self, cell_renderer:Gtk.CellRenderer, attribute:str, column:int)

Adds an attribute mapping to the list in tree_column. The column is thecolumn of the model to get a value from, and the attribute is theparameter on cell_renderer to be set from the value. So for exampleif column 2 of the model contains strings, you could have the“text” attribute of a Gtk.CellRendererText get its values fromcolumn 2.


set_cell_data_func()

set_cell_data_func (self, cell_renderer:Gtk.CellRenderer, func:Gtk.TreeCellDataFunc=None, func_data=None)

Sets the Gtk.TreeCellDataFunc to use for the column. Thisfunction is used instead of the standard attributes mapping forsetting the column value, and should set the value of tree_column'scell renderer as appropriate. func may be None to remove anolder one.


clear_attributes()

clear_attributes (self, cell_renderer:Gtk.CellRenderer)

Clears all existing attributes previously set withGtk.TreeViewColumn:set_attributes().


set_spacing()

set_spacing (self, spacing:int)

Sets the spacing field of tree_column, which is the number of pixels toplace between cell renderers packed into it.


get_spacing()

get_spacing (self) -> int

Returns the spacing of tree_column.

  • Returns: the spacing of tree_column.

set_visible()

set_visible (self, visible:bool)

Sets the visibility of tree_column.


get_visible()

get_visible (self) -> bool

Returns True if tree_column is visible.

  • Returns: whether the column is visible or not. If it is visible, thenthe tree will show the column.

set_resizable()

set_resizable (self, resizable:bool)

If resizable is True, then the user can explicitly resize the column bygrabbing the outer edge of the column button. If resizable is True andsizing mode of the column is GTK_TREE_VIEW_COLUMN_AUTOSIZE, then the sizingmode is changed to GTK_TREE_VIEW_COLUMN_GROW_ONLY.


get_resizable()

get_resizable (self) -> bool

Returns True if the tree_column can be resized by the end user.

  • Returns: True, if the tree_columncan be resized.

set_sizing()

set_sizing (self, type:Gtk.TreeViewColumnSizing)

Sets the growth behavior of tree_column to type.


get_sizing()

get_sizing (self) -> Gtk.TreeViewColumnSizing

Returns the current type of tree_column.

  • Returns: The type of tree_column.

get_width()

get_width (self) -> int

Returns the current size of tree_column in pixels.

  • Returns: The current width of tree_column.

get_fixed_width()

get_fixed_width (self) -> int

Gets the fixed width of the column. This may not be the actual displayedwidth of the column; for that, use Gtk.TreeViewColumn:get_width().

  • Returns: The fixed width of the column.

set_fixed_width()

set_fixed_width (self, fixed_width:int)

If fixed_width is not -1, sets the fixed width of tree_column; otherwiseunsets it. The effective value of fixed_width is clamped between theminimum and maximum width of the column; however, the value stored in the“fixed-width” property is not clamped. If the column sizing isGTK_TREE_VIEW_COLUMN_GROW_ONLY or GTK_TREE_VIEW_COLUMN_AUTOSIZE, settinga fixed width overrides the automatically calculated width. Note thatfixed_width is only a hint to GTK+; the width actually allocated to thecolumn may be greater or less than requested. Along with “expand”, the “fixed-width” property changes when the column isresized by the user.


set_min_width()

set_min_width (self, min_width:int)

Sets the minimum width of the tree_column. If min_width is -1, then theminimum width is unset.


get_min_width()

get_min_width (self) -> int

Returns the minimum width in pixels of the tree_column, or -1 if no minimumwidth is set.

  • Returns: The minimum width of the tree_column.

set_max_width()

set_max_width (self, max_width:int)

Sets the maximum width of the tree_column. If max_width is -1, then themaximum width is unset. Note, the column can actually be wider than maxwidth if it’s the last column in a view. In this case, the column expands tofill any extra space.


get_max_width()

get_max_width (self) -> int

Returns the maximum width in pixels of the tree_column, or -1 if no maximumwidth is set.

  • Returns: The maximum width of the tree_column.

clicked()

clicked (self)

Emits the “clicked” signal on the column. This function will only work iftree_column is clickable.


set_title()

set_title (self, title:str)

Sets the title of the tree_column. If a custom widget has been set, thenthis value is ignored.


get_title()

get_title (self) -> str

Returns the title of the widget.

  • Returns: the title of the column. This string should not bemodified or freed.

set_expand()

set_expand (self, expand:bool)

Sets the column to take available extra space. This space is shared equallyamongst all columns that have the expand set to True. If no column has thisoption set, then the last column gets all extra space. By default, everycolumn is created with this FALSE. Along with “fixed-width”, the “expand” property changes when the column isresized by the user.

  • Since: 2.4

get_expand()

get_expand (self) -> bool

Returns True if the column expands to fill available space.

  • Returns: True if the column expands to fill available space.

  • Since: 2.4


set_clickable()

set_clickable (self, clickable:bool)

Sets the header to be active if clickable is True. When the header isactive, then it can take keyboard focus, and can be clicked.


get_clickable()

get_clickable (self) -> bool

Returns True if the user can click on the header for the column.

  • Returns: True if user can click the column header.

set_widget()

set_widget (self, widget:Gtk.Widget=None)

Sets the widget in the header to be widget. If widget is None, then theheader button is set with a Gtk.Label set to the title of tree_column.


get_widget()

get_widget (self) -> Gtk.Widget

Returns the Gtk.Widget in the button on the column header.If a custom widget has not been set then None is returned.

  • Returns: The Gtk.Widget in the columnheader, or None.

get_button()

get_button (self) -> Gtk.Widget

Returns the button used in the treeview column header

  • Returns: The button for the column header.

  • Since: 3.0


set_alignment()

set_alignment (self, xalign:float)

Sets the alignment of the title or custom widget inside the column header.The alignment determines its location inside the button -- 0.0 for left, 0.5for center, 1.0 for right.


get_alignment()

get_alignment (self) -> float

Returns the current x alignment of tree_column. This value can rangebetween 0.0 and 1.0.

  • Returns: The current alignent of tree_column.

set_reorderable()

set_reorderable (self, reorderable:bool)

If reorderable is True, then the column can be reordered by the end userdragging the header.


get_reorderable()

get_reorderable (self) -> bool

Returns True if the tree_column can be reordered by the user.

  • Returns: True if the tree_columncan be reordered by the user.

set_sort_column_id()

set_sort_column_id (self, sort_column_id:int)

Sets the logical sort_column_id that this column sorts on when this column is selected for sorting. Doing so makes the column header clickable.


get_sort_column_id()

get_sort_column_id (self) -> int

Gets the logical sort_column_id that the model sorts on when thiscolumn is selected for sorting.See Gtk.TreeViewColumn:set_sort_column_id().

  • Returns: the current sort_column_idfor this column, or -1 ifthis column can’t be used for sorting.

set_sort_indicator()

set_sort_indicator (self, setting:bool)

Call this function with a setting of True to display an arrow inthe header button indicating the column is sorted. CallGtk.TreeViewColumn:set_sort_order() to change the direction ofthe arrow.


get_sort_indicator()

get_sort_indicator (self) -> bool

Gets the value set by Gtk.TreeViewColumn:set_sort_indicator().

  • Returns: whether the sort indicator arrow is displayed

set_sort_order()

set_sort_order (self, order:Gtk.SortType)

Changes the appearance of the sort indicator. This does not actually sort the model. UseGtk.TreeViewColumn:set_sort_column_id() if you want automatic sortingsupport. This function is primarily for custom sorting behavior, and shouldbe used in conjunction with `Gtk.TreeSortable:set_sort_column_id()to dothat. For custom models, the mechanism will vary. The sort indicator changes direction to indicate normal sort or reverse sort.Note that you must have the sort indicator enabled to see anything when calling this function; seeGtk.TreeViewColumn:set_sort_indicator()`.


get_sort_order()

get_sort_order (self) -> Gtk.SortType

Gets the value set by Gtk.TreeViewColumn:set_sort_order().

  • Returns: the sort order the sort indicator is indicating

cell_set_cell_data()

cell_set_cell_data (self, tree_model:Gtk.TreeModel, iter:Gtk.TreeIter, is_expander:bool, is_expanded:bool)

Sets the cell renderer based on the tree_model and iter. That is, forevery attribute mapping in tree_column, it will get a value from the setcolumn on the iter, and use that value to set the attribute on the cellrenderer. This is used primarily by the Gtk.TreeView.


cell_get_size()

cell_get_size (self, cell_area:Gdk.Rectangle=None) -> x_offset:int, y_offset:int, width:int, height:int

Obtains the width and height needed to render the column. This is usedprimarily by the Gtk.TreeView.


cell_is_visible()

cell_is_visible (self) -> bool

Returns True if any of the cells packed into the tree_column are visible.For this to be meaningful, you must first initialize the cells withGtk.TreeViewColumn:cell_set_cell_data()

  • Returns: True, if any of the cells packed into the tree_columnare currently visible

focus_cell()

focus_cell (self, cell:Gtk.CellRenderer)

Sets the current keyboard focus to be at cell, if the column contains2 or more editable and activatable cells.

  • Since: 2.2

queue_resize()

queue_resize (self)

Flags the column, and the cell renderers added to this column, to havetheir sizes renegotiated.

  • Since: 2.8

get_tree_view()

get_tree_view (self) -> Gtk.Widget

Returns the Gtk.TreeView wherein tree_column has been inserted.If column is currently not inserted in any tree view, None isreturned.

  • Returns: The tree view wherein columnhasbeen inserted if any, None otherwise.

  • Since: 2.12


get_x_offset()

get_x_offset (self) -> int

Returns the current X offset of tree_column in pixels.

  • Returns: The current X offset of tree_column.

  • Since: 3.2


results matching ""

    No results matching ""