CellRendererText#
Deprecated since version 4.10: List views use widgets to display their contents.
You should use Inscription or Label instead
Superclasses: CellRenderer, InitiallyUnowned, Object
Subclasses: CellRendererAccel, CellRendererCombo, CellRendererSpin
Renders text in a cell
A GtkCellRendererText renders a given text in its cell, using the font, color and
style information provided by its properties. The text will be ellipsized if it is
too long and the GtkCellRendererText:ellipsize property allows it.
If the GtkCellRenderer:mode is EDITABLE,
the GtkCellRendererText allows to edit its text using an entry.
Constructors#
- class CellRendererText
- classmethod new() CellRenderer#
Creates a new
GtkCellRendererText. Adjust how text is drawn using object properties. Object properties can be set globally (withset()). Also, withGtkTreeViewColumn, you can bind a property to a value in aGtkTreeModel. For example, you can bind the “text” property on the cell renderer to a string value in the model, thus rendering a different string in each row of theGtkTreeView.Deprecated since version 4.10: Please do not use it in newly written code
Methods#
- class CellRendererText
-
- set_fixed_height_from_font(number_of_rows: int) None#
Sets the height of a renderer to explicitly be determined by the “font” and “y_pad” property set on it. Further changes in these properties do not affect the height, so they must be accompanied by a subsequent call to this function. Using this function is inflexible, and should really only be used if calculating the size of a cell is too slow (ie, a massive number of cells displayed). If
number_of_rowsis -1, then the fixed height is unset, and the height is determined by the properties again.Deprecated since version 4.10: Please do not use it in newly written code
- Parameters:
number_of_rows – Number of rows of text each cell renderer is allocated, or -1
Properties#
- class CellRendererText
-
- props.alignment: Alignment#
Specifies how to align the lines of text with respect to each other.
Note that this property describes how to align the lines of text in case there are several of them. The “xalign” property of
GtkCellRenderer, on the other hand, sets the horizontal alignment of the whole text.
- props.ellipsize: EllipsizeMode#
Specifies the preferred place to ellipsize the string, if the cell renderer does not have enough room to display the entire string. Setting it to %PANGO_ELLIPSIZE_NONE turns off ellipsizing. See the wrap-width property for another way of making the text fit into a given width.
- props.font_desc: FontDescription#
- props.max_width_chars: int#
The desired maximum width of the cell, in characters. If this property is set to -1, the width will be calculated automatically.
For cell renderers that ellipsize or wrap text; this property controls the maximum reported width of the cell. The cell should not receive any greater allocation unless it is set to expand in its
GtkCellLayoutand all of the cell’s siblings have received their natural width.
- props.placeholder_text: str#
The text that will be displayed in the
GtkCellRendererifGtkCellRendererText:editableisTrueand the cell is empty.
- props.width_chars: int#
The desired width of the cell, in characters. If this property is set to -1, the width will be calculated automatically, otherwise the cell will request either 3 characters or the property value, whichever is greater.
Signals#
- class CellRendererText.signals
Virtual Methods#
Fields#
- class CellRendererText
- parent#