Gtk.TreeViewColumn¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
X Alignment of the column header text or widget |
||
r/w/co |
The |
||
r/w/en |
Whether the header can be clicked |
||
r/w/en |
Column gets share of extra width allocated to the widget |
||
r/w/en |
Current fixed width of the column |
||
r/w/en |
Maximum allowed width of the column |
||
r/w/en |
Minimum allowed width of the column |
||
r/w/en |
Whether the column can be reordered around the headers |
||
r/w/en |
Column is user-resizable |
||
r/w/en |
Resize mode of the column |
||
r/w/en |
Logical sort column ID this column sorts on when selected for sorting |
||
r/w/en |
Whether to show a sort indicator |
||
r/w/en |
Sort direction the sort indicator should indicate |
||
r/w/en |
Space which is inserted between cells |
||
r/w |
Title to appear in column header |
||
r/w/en |
Whether to display the column |
||
r/w |
Widget to put in column header button instead of column title |
||
r |
Current width of the column |
||
r |
Current X position of the column |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gtk.TreeViewColumn(title='', cell_renderer=None, **attributes)¶
- Bases:
- Abstract:
No
- Structure:
The
Gtk.TreeViewColumn
object represents a visible column in aGtk.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 overview for an overview of all the objects and data types related to the tree widget and how they work together.
- classmethod new()[source]¶
- Returns:
A newly created
Gtk.TreeViewColumn
.- Return type:
Creates a new
Gtk.TreeViewColumn
.
- classmethod new_with_area(area)[source]¶
- Parameters:
area (
Gtk.CellArea
) – theGtk.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
) – theGtk.CellRenderer
to set attributes onattribute (
str
) – An attribute on the renderercolumn (
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
) – aGtk.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:
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
orNone
) – The area a cell in the column will be allocated, orNone
- Returns:
- Return type:
Obtains the width and height needed to render the column. This is used primarily by the
Gtk.TreeView
.
- cell_is_visible()[source]¶
-
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
) – TheGtk.TreeModel
to to get the cell renderers attributes from.iter (
Gtk.TreeIter
) – TheGtk.TreeIter
to to get the cell renderer’s attributes from.
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
.
- clear_attributes(cell_renderer)[source]¶
- Parameters:
cell_renderer (
Gtk.CellRenderer
) – aGtk.CellRenderer
to clear the attribute mapping on.
Clears all existing attributes previously set with
Gtk.TreeViewColumn.set_attributes
().
- clicked()[source]¶
Emits the “clicked” signal on the column. This function will only work if self is clickable.
- focus_cell(cell)[source]¶
- Parameters:
cell (
Gtk.CellRenderer
) – AGtk.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.
- get_alignment()[source]¶
- 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.
- get_button()[source]¶
- Returns:
The button for the column header.
- Return type:
Returns the button used in the treeview column header
New in version 3.0.
- get_expand()[source]¶
-
Returns
True
if the column expands to fill available space.New in version 2.4.
- get_fixed_width()[source]¶
- 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
().
- get_max_width()[source]¶
- 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.
- get_min_width()[source]¶
- 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.
- get_sort_column_id()[source]¶
- 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
().
- get_sort_indicator()[source]¶
- Returns:
whether the sort indicator arrow is displayed
- Return type:
Gets the value set by
Gtk.TreeViewColumn.set_sort_indicator
().
- get_sort_order()[source]¶
- Returns:
the sort order the sort indicator is indicating
- Return type:
Gets the value set by
Gtk.TreeViewColumn.set_sort_order
().
- get_title()[source]¶
- Returns:
the title of the column. This string should not be modified or freed.
- Return type:
Returns the title of the widget.
- get_tree_view()[source]¶
- Returns:
The tree view wherein column has been inserted if any,
None
otherwise.- Return type:
Gtk.Widget
orNone
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.
- get_visible()[source]¶
- 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.
- get_widget()[source]¶
- Returns:
The
Gtk.Widget
in the column header, orNone
- Return type:
Gtk.Widget
orNone
Returns the
Gtk.Widget
in the button on the column header. If a custom widget has not been set thenNone
is returned.
- get_width()[source]¶
- Returns:
The current width of self.
- Return type:
Returns the current size of self in pixels.
- get_x_offset()[source]¶
- 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
) – TheGtk.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 cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand isTrue
.
- pack_start(cell, expand)[source]¶
- Parameters:
cell (
Gtk.CellRenderer
) – TheGtk.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 isTrue
.
- queue_resize()[source]¶
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
) – theGtk.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 in
Gtk.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
) – AGtk.CellRenderer
func (
Gtk.TreeCellDataFunc
orNone
) – TheGtk.TreeCellDataFunc
to use.
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 beNone
to remove an older one.
- set_clickable(clickable)[source]¶
-
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.
- set_expand(expand)[source]¶
-
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 thisFalse
.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 is
Gtk.TreeViewColumnSizing.GROW_ONLY
orGtk.TreeViewColumnSizing.AUTOSIZE
, setting a fixed width overrides the automatically calculated width. Note that fixed_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]¶
-
If reorderable is
True
, then the column can be reordered by the end user dragging the header.
- set_resizable(resizable)[source]¶
-
If resizable is
True
, then the user can explicitly resize the column by grabbing the outer edge of the column button. If resizable isTrue
and sizing mode of the column isGtk.TreeViewColumnSizing.AUTOSIZE
, then the sizing mode is changed toGtk.TreeViewColumnSizing.GROW_ONLY
.
- set_sizing(type)[source]¶
- Parameters:
type (
Gtk.TreeViewColumnSizing
) – TheGtk.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]¶
-
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. Use
Gtk.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 withGtk.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
().
- set_spacing(spacing)[source]¶
- 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.
- set_title(title)[source]¶
- 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.
- set_widget(widget)[source]¶
- Parameters:
widget (
Gtk.Widget
orNone
) – A childGtk.Widget
, orNone
.
Sets the widget in the header to be widget. If widget is
None
, then the header button is set with aGtk.Label
set to the title of self.
- do_clicked() virtual¶
Emits the “clicked” signal on the column. This function will only work if tree_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:
X Alignment of the column header text or widget
- Gtk.TreeViewColumn.props.cell_area¶
- Name:
cell-area
- Type:
- Default Value:
- Flags:
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 orientedGtk.CellAreaBox
will be used.New in version 3.0.
- Gtk.TreeViewColumn.props.clickable¶
- Name:
clickable
- Type:
- Default Value:
- Flags:
Whether the header can be clicked
- Gtk.TreeViewColumn.props.expand¶
- Name:
expand
- Type:
- Default Value:
- Flags:
Column gets share of extra width allocated to the widget
- Gtk.TreeViewColumn.props.fixed_width¶
- Name:
fixed-width
- Type:
- Default Value:
-1
- Flags:
Current fixed width of the column
- Gtk.TreeViewColumn.props.max_width¶
- Name:
max-width
- Type:
- Default Value:
-1
- Flags:
Maximum allowed width of the column
- Gtk.TreeViewColumn.props.min_width¶
- Name:
min-width
- Type:
- Default Value:
-1
- Flags:
Minimum allowed width of the column
- Gtk.TreeViewColumn.props.reorderable¶
- Name:
reorderable
- Type:
- Default Value:
- Flags:
Whether the column can be reordered around the headers
- Gtk.TreeViewColumn.props.resizable¶
- Name:
resizable
- Type:
- Default Value:
- Flags:
Column is user-resizable
- Gtk.TreeViewColumn.props.sizing¶
- Name:
sizing
- Type:
- Default Value:
- Flags:
Resize mode of the column
- Gtk.TreeViewColumn.props.sort_column_id¶
- Name:
sort-column-id
- Type:
- Default Value:
-1
- Flags:
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:
Whether to show a sort indicator
- Gtk.TreeViewColumn.props.sort_order¶
- Name:
sort-order
- Type:
- Default Value:
- Flags:
Sort direction the sort indicator should indicate
- Gtk.TreeViewColumn.props.spacing¶
- Name:
spacing
- Type:
- Default Value:
0
- Flags:
Space which is inserted between cells
- Gtk.TreeViewColumn.props.title¶
-
Title to appear in column header
- Gtk.TreeViewColumn.props.visible¶
- Name:
visible
- Type:
- Default Value:
- Flags:
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¶
-
Current width of the column