CellRendererText#

Deprecated since version 4.10: List views use widgets to display their contents. You should use Inscription or Label instead

class CellRendererText(**properties: Any)#

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 (with set()). Also, with GtkTreeViewColumn, you can bind a property to a value in a GtkTreeModel. 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 the GtkTreeView.

Deprecated since version 4.10: Please do not use it in newly written code

Methods#

class CellRendererText
do_edited(self, path: str, new_text: str) None#
Parameters:
  • path

  • new_text

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_rows is -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.align_set: bool#
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.attributes: AttrList#
props.background: str#
props.background_rgba: RGBA#

Background color as a GdkRGBA

props.background_set: bool#
props.editable: bool#
props.editable_set: bool#
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.ellipsize_set: bool#
props.family: str#
props.family_set: bool#
props.font: str#
props.font_desc: FontDescription#
props.foreground: str#
props.foreground_rgba: RGBA#

Foreground color as a GdkRGBA

props.foreground_set: bool#
props.language: str#
props.language_set: bool#
props.markup: str#
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 GtkCellLayout and all of the cell’s siblings have received their natural width.

props.placeholder_text: str#

The text that will be displayed in the GtkCellRenderer if GtkCellRendererText:editable is True and the cell is empty.

props.rise: int#
props.rise_set: bool#
props.scale: float#
props.scale_set: bool#
props.single_paragraph_mode: bool#
props.size: int#
props.size_points: float#
props.size_set: bool#
props.stretch: Stretch#
props.stretch_set: bool#
props.strikethrough: bool#
props.strikethrough_set: bool#
props.style: Style#
props.style_set: bool#
props.text: str#
props.underline: Underline#
props.underline_set: bool#
props.variant: Variant#
props.variant_set: bool#
props.weight: int#
props.weight_set: bool#
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.

props.wrap_mode: WrapMode#

Specifies how to break the string into multiple lines, if the cell renderer does not have enough room to display the entire string. This property has no effect unless the wrap-width property is set.

props.wrap_width: int#

Specifies the minimum width at which the text is wrapped. The wrap-mode property can be used to influence at what character positions the line breaks can be placed. Setting wrap-width to -1 turns wrapping off.

Signals#

class CellRendererText.signals
edited(path: str, new_text: str) None#

This signal is emitted after renderer has been edited.

It is the responsibility of the application to update the model and store new_text at the position indicated by path.

Parameters:
  • path – the path identifying the edited cell

  • new_text – the new text

Virtual Methods#

class CellRendererText
do_edited(path: str, new_text: str) None#
Parameters:
  • path

  • new_text

Fields#

class CellRendererText
parent#