Gtk.TreeViewColumn - Classes - Gtk 3.0 (original) (raw)
g GObject.GInterface GObject.GInterface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.CellLayout Gtk.CellLayout GObject.GInterface->Gtk.CellLayout GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.TreeViewColumn Gtk.TreeViewColumn GObject.InitiallyUnowned->Gtk.TreeViewColumn GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Buildable->Gtk.TreeViewColumn Gtk.CellLayout->Gtk.TreeViewColumn
Subclasses:
None
Methods¶
Inherited:
GObject.Object (37), Gtk.Buildable (10), Gtk.CellLayout (9)
Structs:
Virtual Methods¶
Inherited:
GObject.Object (7), Gtk.Buildable (10), Gtk.CellLayout (9)
do_clicked () |
---|
Properties¶
Name | Type | Flags | Short Description |
---|---|---|---|
alignment | float | r/w/en | X Alignment of the column header text or widget |
cell-area | Gtk.CellArea | r/w/co | The Gtk.CellArea used to layout cells |
clickable | bool | r/w/en | Whether the header can be clicked |
expand | bool | r/w/en | Column gets share of extra width allocated to the widget |
fixed-width | int | r/w/en | Current fixed width of the column |
max-width | int | r/w/en | Maximum allowed width of the column |
min-width | int | r/w/en | Minimum allowed width of the column |
reorderable | bool | r/w/en | Whether the column can be reordered around the headers |
resizable | bool | r/w/en | Column is user-resizable |
sizing | Gtk.TreeViewColumnSizing | r/w/en | Resize mode of the column |
sort-column-id | int | r/w/en | Logical sort column ID this column sorts on when selected for sorting |
sort-indicator | bool | r/w/en | Whether to show a sort indicator |
sort-order | Gtk.SortType | r/w/en | Sort direction the sort indicator should indicate |
spacing | int | r/w/en | Space which is inserted between cells |
title | str | r/w | Title to appear in column header |
visible | bool | r/w/en | Whether to display the column |
widget | Gtk.Widget | r/w | Widget to put in column header button instead of column title |
width | int | r | Current width of the column |
x-offset | int | r | Current X position of the column |
Signals¶
Inherited:
Name | Short Description |
---|---|
clicked |
Fields¶
Inherited:
Name | Type | Access | Description |
---|---|---|---|
parent_instance | GObject.InitiallyUnowned | r |
Class Details¶
class Gtk.TreeViewColumn(title='', cell_renderer=None, **attributes)¶
Bases:
GObject.InitiallyUnowned, Gtk.Buildable, Gtk.CellLayout
Abstract:
No
Structure:
The Gtk.TreeViewColumn object represents a visible column in a Gtk.TreeView 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 overviewfor an overview of all the objects and data types related to the tree widget and how they work together.
Returns:
A newly created Gtk.TreeViewColumn.
Return type:
Creates a new Gtk.TreeViewColumn.
classmethod new_with_area(area)[source]¶
Parameters:
area (Gtk.CellArea) – the Gtk.CellArea that the newly created column should use to layout cells.
Returns:
A newly created Gtk.TreeViewColumn.
Return type:
Creates a new Gtk.TreeViewColumn using area to render its cells.
New in version 3.0.
add_attribute(cell_renderer, attribute, column)[source]¶
Parameters:
- cell_renderer (Gtk.CellRenderer) – the Gtk.CellRenderer to set attributes on
- attribute (str) – An attribute on the renderer
- column (int) – The column position on the model to get the attribute from.
Adds an attribute mapping to the list in self. The column is the column of the model to get a value from, and the attribute is the parameter on cell_renderer to be set from the value. So for example if column 2 of the model contains strings, you could have the “text” attribute of a Gtk.CellRendererText get its values from column 2.
cell_get_position(cell_renderer)[source]¶
Parameters:
cell_renderer (Gtk.CellRenderer) – a Gtk.CellRenderer
Returns:
None if cell does not belong to self or a tuple containing:
x_offset:
the horizontal position of cell within self
width:
the width of cell
Return type:
(x_offset: int, width: int) or None
Obtains the horizontal position and size of a cell in a column. If the cell is not found in the column None is returned.
cell_get_size(cell_area)[source]¶
Parameters:
cell_area (Gdk.Rectangle or None) – The area a cell in the column will be allocated, or None
Returns:
x_offset:
location to return x offset of a cell relative to cell_area, or None
y_offset:
location to return y offset of a cell relative to cell_area, or None
width:
location to return width needed to render a cell, or None
height:
location to return height needed to render a cell, or None
Return type:
(x_offset: int, y_offset: int, width: int, height: int)
Obtains the width and height needed to render the column. This is used primarily by the Gtk.TreeView.
Returns:
True, if any of the cells packed into the self are currently visible
Return type:
Returns True if any of the cells packed into the self are visible. For this to be meaningful, you must first initialize the cells withGtk.TreeViewColumn.cell_set_cell_data()
cell_set_cell_data(tree_model, iter, is_expander, is_expanded)[source]¶
Parameters:
- tree_model (Gtk.TreeModel) – The Gtk.TreeModel to to get the cell renderers attributes from.
- iter (Gtk.TreeIter) – The Gtk.TreeIter to to get the cell renderer’s attributes from.
- is_expander (bool) – True, if the row has children
- is_expanded (bool) – True, if the row has visible children
Sets the cell renderer based on the tree_model and iter. That is, for every attribute mapping in self, it will get a value from the set column on the iter, and use that value to set the attribute on the cell renderer. This is used primarily by the Gtk.TreeView.
Unsets all the mappings on all renderers on the self.
clear_attributes(cell_renderer)[source]¶
Parameters:
cell_renderer (Gtk.CellRenderer) – a Gtk.CellRenderer to clear the attribute mapping on.
Clears all existing attributes previously set withGtk.TreeViewColumn.set_attributes().
Emits the “clicked” signal on the column. This function will only work ifself is clickable.
Parameters:
cell (Gtk.CellRenderer) – A Gtk.CellRenderer
Sets the current keyboard focus to be at cell, if the column contains 2 or more editable and activatable cells.
New in version 2.2.
Returns:
The current alignent of self.
Return type:
Returns the current x alignment of self. This value can range between 0.0 and 1.0.
Returns:
The button for the column header.
Return type:
Returns the button used in the treeview column header
New in version 3.0.
Returns:
True if user can click the column header.
Return type:
Returns True if the user can click on the header for the column.
Returns:
True if the column expands to fill available space.
Return type:
Returns True if the column expands to fill available space.
New in version 2.4.
Returns:
The fixed width of the column.
Return type:
Gets the fixed width of the column. This may not be the actual displayed width of the column; for that, use Gtk.TreeViewColumn.get_width().
Returns:
The maximum width of the self.
Return type:
Returns the maximum width in pixels of the self, or -1 if no maximum width is set.
Returns:
The minimum width of the self.
Return type:
Returns the minimum width in pixels of the self, or -1 if no minimum width is set.
Returns:
True if the self can be reordered by the user.
Return type:
Returns True if the self can be reordered by the user.
Returns:
True, if the self can be resized.
Return type:
Returns True if the self can be resized by the end user.
Returns:
The type of self.
Return type:
Returns the current type of self.
Returns:
the current sort_column_id for this column, or -1 if this column can’t be used for sorting.
Return type:
Gets the logical sort_column_id that the model sorts on when this column is selected for sorting. See Gtk.TreeViewColumn.set_sort_column_id().
Returns:
whether the sort indicator arrow is displayed
Return type:
Gets the value set by Gtk.TreeViewColumn.set_sort_indicator().
Returns:
the sort order the sort indicator is indicating
Return type:
Gets the value set by Gtk.TreeViewColumn.set_sort_order().
Returns:
the spacing of self.
Return type:
Returns the spacing of self.
Returns:
the title of the column. This string should not be modified or freed.
Return type:
Returns the title of the widget.
Returns:
The tree view wherein column has been inserted if any, None otherwise.
Return type:
Gtk.Widget or None
Returns the Gtk.TreeView wherein self has been inserted. If column is currently not inserted in any tree view, None is returned.
New in version 2.12.
Returns:
whether the column is visible or not. If it is visible, then the tree will show the column.
Return type:
Returns True if self is visible.
Returns:
The Gtk.Widget in the column header, or None
Return type:
Gtk.Widget or None
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 current width of self.
Return type:
Returns the current size of self in pixels.
Returns:
The current X offset of self.
Return type:
Returns the current X offset of self in pixels.
New in version 3.2.
pack_end(cell, expand)[source]¶
Parameters:
- cell (Gtk.CellRenderer) – The Gtk.CellRenderer.
- expand (bool) – True if cell is to be given extra space allocated to self.
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 divided evenly between cells for which expand is True.
pack_start(cell, expand)[source]¶
Parameters:
- cell (Gtk.CellRenderer) – The Gtk.CellRenderer.
- expand (bool) – True if cell is to be given extra space allocated to self.
Packs the cell into the beginning of the column. If expand is False, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is True.
Flags the column, and the cell renderers added to this column, to have their sizes renegotiated.
New in version 2.8.
set_alignment(xalign)[source]¶
Parameters:
xalign (float) – The alignment, which is between [0.0 and 1.0] inclusive.
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.5 for center, 1.0 for right.
set_attributes(cell_renderer, **attributes)[source]¶
Parameters:
cell_renderer (Gtk.CellRenderer) – the Gtk.CellRenderer we’re setting the attributes of
Sets the attributes in the list as the attributes of self. The attributes should be in attribute/column order, as inGtk.TreeViewColumn.add_attribute(). All existing attributes are removed, and replaced with the new attributes.
set_cell_data_func(cell_renderer, func, *func_data)[source]¶
Parameters:
- cell_renderer (Gtk.CellRenderer) – A Gtk.CellRenderer
- func (Gtk.TreeCellDataFunc or None) – The Gtk.TreeCellDataFunc to use.
- func_data (object or None) – The user data for func.
Sets the Gtk.TreeCellDataFunc to use for the column. This function is used instead of the standard attributes mapping for setting the column value, and should set the value of self's cell renderer as appropriate. func may be None to remove an older one.
set_clickable(clickable)[source]¶
Parameters:
clickable (bool) – True if the header is active.
Sets the header to be active if clickable is True. When the header is active, then it can take keyboard focus, and can be clicked.
Parameters:
expand (bool) – True if the column should expand to fill available space.
Sets the column to take available extra space. This space is shared equally amongst all columns that have the expand set to True. If no column has this option set, then the last column gets all extra space. By default, every column is created with this False.
Along with “fixed-width”, the “expand” property changes when the column is resized by the user.
New in version 2.4.
set_fixed_width(fixed_width)[source]¶
Parameters:
fixed_width (int) – The new fixed width, in pixels, or -1.
If fixed_width is not -1, sets the fixed width of self; otherwise unsets it. The effective value of fixed_width is clamped between the minimum and maximum width of the column; however, the value stored in the “fixed-width” property is not clamped. If the column sizing isGtk.TreeViewColumnSizing.GROW_ONLY or Gtk.TreeViewColumnSizing.AUTOSIZE, setting a fixed width overrides the automatically calculated width. Note thatfixed_width is only a hint to GTK+; the width actually allocated to the column may be greater or less than requested.
Along with “expand”, the “fixed-width” property changes when the column is resized by the user.
set_max_width(max_width)[source]¶
Parameters:
max_width (int) – The maximum width of the column in pixels, or -1.
Sets the maximum width of the self. If max_width is -1, then the maximum width is unset. Note, the column can actually be wider than max width if it’s the last column in a view. In this case, the column expands to fill any extra space.
set_min_width(min_width)[source]¶
Parameters:
min_width (int) – The minimum width of the column in pixels, or -1.
Sets the minimum width of the self. If min_width is -1, then the minimum width is unset.
set_reorderable(reorderable)[source]¶
Parameters:
reorderable (bool) – True, if the column can be reordered.
If reorderable is True, then the column can be reordered by the end user dragging the header.
set_resizable(resizable)[source]¶
Parameters:
resizable (bool) – True, if the column can be resized
If resizable is True, then the user can explicitly resize the column by grabbing the outer edge of the column button. If resizable is True and sizing mode of the column is Gtk.TreeViewColumnSizing.AUTOSIZE, then the sizing mode is changed to Gtk.TreeViewColumnSizing.GROW_ONLY.
Parameters:
type (Gtk.TreeViewColumnSizing) – The Gtk.TreeViewColumnSizing.
Sets the growth behavior of self to type.
set_sort_column_id(sort_column_id)[source]¶
Parameters:
sort_column_id (int) – The sort_column_id of the model to sort on.
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.
set_sort_indicator(setting)[source]¶
Parameters:
setting (bool) – True to display an indicator that the column is sorted
Call this function with a setting of True to display an arrow in the header button indicating the column is sorted. CallGtk.TreeViewColumn.set_sort_order() to change the direction of the arrow.
set_sort_order(order)[source]¶
Parameters:
order (Gtk.SortType) – sort order that the sort indicator should indicate
Changes the appearance of the sort indicator.
This does not actually sort the model. UseGtk.TreeViewColumn.set_sort_column_id() if you want automatic sorting support. This function is primarily for custom sorting behavior, and should be used in conjunction with Gtk.TreeSortable.set_sort_column_id() to do that. 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; see Gtk.TreeViewColumn.set_sort_indicator().
Parameters:
spacing (int) – distance between cell renderers in pixels.
Sets the spacing field of self, which is the number of pixels to place between cell renderers packed into it.
Parameters:
title (str) – The title of the self.
Sets the title of the self. If a custom widget has been set, then this value is ignored.
Parameters:
visible (bool) – True if the self is visible.
Sets the visibility of self.
Parameters:
widget (Gtk.Widget or None) – A child Gtk.Widget, or None.
Sets the widget in the header to be widget. If widget is None, then the header button is set with a Gtk.Label set to the title of self.
do_clicked() virtual¶
Emits the “clicked” signal on the column. This function will only work iftree_column is clickable.
Signal Details¶
Gtk.TreeViewColumn.signals.clicked(tree_view_column)¶
Signal Name:
clicked
Flags:
Parameters:
tree_view_column (Gtk.TreeViewColumn) – The object which received the signal
Property Details¶
Gtk.TreeViewColumn.props.alignment¶
Name:
alignment
Type:
Default Value:
0.0
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
X Alignment of the column header text or widget
Gtk.TreeViewColumn.props.cell_area¶
Name:
cell-area
Type:
Default Value:
Flags:
READABLE, WRITABLE, CONSTRUCT_ONLY
The Gtk.CellArea used to layout cell renderers for this column.
If no area is specified when creating the tree view column with Gtk.TreeViewColumn.new_with_area() a horizontally oriented Gtk.CellAreaBox will be used.
New in version 3.0.
Gtk.TreeViewColumn.props.clickable¶
Name:
clickable
Type:
Default Value:
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Whether the header can be clicked
Gtk.TreeViewColumn.props.expand¶
Name:
expand
Type:
Default Value:
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Column gets share of extra width allocated to the widget
Gtk.TreeViewColumn.props.fixed_width¶
Name:
fixed-width
Type:
Default Value:
-1
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Current fixed width of the column
Gtk.TreeViewColumn.props.max_width¶
Name:
max-width
Type:
Default Value:
-1
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Maximum allowed width of the column
Gtk.TreeViewColumn.props.min_width¶
Name:
min-width
Type:
Default Value:
-1
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Minimum allowed width of the column
Gtk.TreeViewColumn.props.reorderable¶
Name:
reorderable
Type:
Default Value:
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Whether the column can be reordered around the headers
Gtk.TreeViewColumn.props.resizable¶
Name:
resizable
Type:
Default Value:
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Column is user-resizable
Gtk.TreeViewColumn.props.sizing¶
Name:
sizing
Type:
Default Value:
Gtk.TreeViewColumnSizing.GROW_ONLY
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Resize mode of the column
Gtk.TreeViewColumn.props.sort_column_id¶
Name:
sort-column-id
Type:
Default Value:
-1
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header clickable. Set to -1 to make the column unsortable.
New in version 2.18.
Gtk.TreeViewColumn.props.sort_indicator¶
Name:
sort-indicator
Type:
Default Value:
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Whether to show a sort indicator
Gtk.TreeViewColumn.props.sort_order¶
Name:
sort-order
Type:
Default Value:
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Sort direction the sort indicator should indicate
Gtk.TreeViewColumn.props.spacing¶
Name:
spacing
Type:
Default Value:
0
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Space which is inserted between cells
Gtk.TreeViewColumn.props.title¶
Name:
title
Type:
Default Value:
''
Flags:
Title to appear in column header
Gtk.TreeViewColumn.props.visible¶
Name:
visible
Type:
Default Value:
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Whether to display the column
Gtk.TreeViewColumn.props.widget¶
Name:
widget
Type:
Default Value:
Flags:
Widget to put in column header button instead of column title
Gtk.TreeViewColumn.props.width¶
Name:
width
Type:
Default Value:
0
Flags:
Current width of the column
Gtk.TreeViewColumn.props.x_offset¶
Name:
x-offset
Type:
Default Value:
0
Flags:
Current X position of the column