Gtk.CellRendererText

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.CellRenderer Gtk.CellRenderer GObject.InitiallyUnowned->Gtk.CellRenderer GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.CellRendererText Gtk.CellRendererText Gtk.CellRenderer->Gtk.CellRendererText

Subclasses:

Gtk.CellRendererAccel, Gtk.CellRendererCombo, Gtk.CellRendererSpin

Methods

Inherited:

Gtk.CellRenderer (27), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

set_fixed_height_from_font (number_of_rows)

Virtual Methods

Inherited:

Gtk.CellRenderer (11), GObject.Object (7)

do_edited (path, new_text)

Properties

Inherited:

Gtk.CellRenderer (15)

Name

Type

Flags

Short Description

align-set

bool

r/w

alignment

Pango.Alignment

r/w/en

attributes

Pango.AttrList

r/w

background

str

w

background-rgba

Gdk.RGBA

r/w

background-set

bool

r/w

editable

bool

r/w

editable-set

bool

r/w

ellipsize

Pango.EllipsizeMode

r/w/en

ellipsize-set

bool

r/w

family

str

r/w

family-set

bool

r/w

font

str

r/w

font-desc

Pango.FontDescription

r/w

foreground

str

w

foreground-rgba

Gdk.RGBA

r/w

foreground-set

bool

r/w

language

str

r/w

language-set

bool

r/w

markup

str

w

max-width-chars

int

r/w/en

placeholder-text

str

r/w

rise

int

r/w

rise-set

bool

r/w

scale

float

r/w

scale-set

bool

r/w

single-paragraph-mode

bool

r/w/en

size

int

r/w

size-points

float

r/w

size-set

bool

r/w

stretch

Pango.Stretch

r/w

stretch-set

bool

r/w

strikethrough

bool

r/w

strikethrough-set

bool

r/w

style

Pango.Style

r/w

style-set

bool

r/w

text

str

r/w

underline

Pango.Underline

r/w

underline-set

bool

r/w

variant

Pango.Variant

r/w

variant-set

bool

r/w

weight

int

r/w

weight-set

bool

r/w

width-chars

int

r/w/en

wrap-mode

Pango.WrapMode

r/w/en

wrap-width

int

r/w/en

Signals

Inherited:

Gtk.CellRenderer (2), GObject.Object (1)

Name

Short Description

edited

This signal is emitted after renderer has been edited.

Fields

Inherited:

Gtk.CellRenderer (2), GObject.Object (1)

Name

Type

Access

Description

parent

Gtk.CellRenderer

r

Class Details

class Gtk.CellRendererText(**kwargs)
Bases:

Gtk.CellRenderer

Abstract:

No

Structure:

Gtk.CellRendererTextClass

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 Gtk.CellRendererMode.EDITABLE, the GtkCellRendererText allows to edit its text using an entry.

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

classmethod new()[source]
Returns:

the new cell renderer

Return type:

Gtk.CellRenderer

Creates a new GtkCellRendererText. Adjust how text is drawn using object properties. Object properties can be set globally (with g_object_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.

set_fixed_height_from_font(number_of_rows)[source]
Parameters:

number_of_rows (int) – Number of rows of text each cell renderer is allocated, or -1

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.

do_edited(path, new_text) virtual
Parameters:
  • path (str) –

  • new_text (str) –

Signal Details

Gtk.CellRendererText.signals.edited(cell_renderer_text, path, new_text)
Signal Name:

edited

Flags:

RUN_LAST

Parameters:
  • cell_renderer_text (Gtk.CellRendererText) – The object which received the signal

  • path (str) – the path identifying the edited cell

  • new_text (str) – the new text

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.

Property Details

Gtk.CellRendererText.props.align_set
Name:

align-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.alignment
Name:

alignment

Type:

Pango.Alignment

Default Value:

Pango.Alignment.LEFT

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.

Gtk.CellRendererText.props.attributes
Name:

attributes

Type:

Pango.AttrList

Default Value:

None

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.background
Name:

background

Type:

str

Default Value:

None

Flags:

WRITABLE

Gtk.CellRendererText.props.background_rgba
Name:

background-rgba

Type:

Gdk.RGBA

Default Value:

None

Flags:

READABLE, WRITABLE

Background color as a GdkRGBA

Gtk.CellRendererText.props.background_set
Name:

background-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.editable
Name:

editable

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.editable_set
Name:

editable-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.ellipsize
Name:

ellipsize

Type:

Pango.EllipsizeMode

Default Value:

Pango.EllipsizeMode.NONE

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.EllipsizeMode.NONE turns off ellipsizing. See the wrap-width property for another way of making the text fit into a given width.

Gtk.CellRendererText.props.ellipsize_set
Name:

ellipsize-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.family
Name:

family

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.family_set
Name:

family-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.font
Name:

font

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.font_desc
Name:

font-desc

Type:

Pango.FontDescription

Default Value:

None

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.foreground
Name:

foreground

Type:

str

Default Value:

None

Flags:

WRITABLE

Gtk.CellRendererText.props.foreground_rgba
Name:

foreground-rgba

Type:

Gdk.RGBA

Default Value:

None

Flags:

READABLE, WRITABLE

Foreground color as a GdkRGBA

Gtk.CellRendererText.props.foreground_set
Name:

foreground-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.language
Name:

language

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.language_set
Name:

language-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.markup
Name:

markup

Type:

str

Default Value:

None

Flags:

WRITABLE

Gtk.CellRendererText.props.max_width_chars
Name:

max-width-chars

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.

Gtk.CellRendererText.props.placeholder_text
Name:

placeholder-text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

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

Gtk.CellRendererText.props.rise
Name:

rise

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.rise_set
Name:

rise-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.scale
Name:

scale

Type:

float

Default Value:

1.0

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.scale_set
Name:

scale-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.single_paragraph_mode
Name:

single-paragraph-mode

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Gtk.CellRendererText.props.size
Name:

size

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.size_points
Name:

size-points

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.size_set
Name:

size-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.stretch
Name:

stretch

Type:

Pango.Stretch

Default Value:

Pango.Stretch.NORMAL

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.stretch_set
Name:

stretch-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.strikethrough
Name:

strikethrough

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.strikethrough_set
Name:

strikethrough-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.style
Name:

style

Type:

Pango.Style

Default Value:

Pango.Style.NORMAL

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.style_set
Name:

style-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.text
Name:

text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.underline
Name:

underline

Type:

Pango.Underline

Default Value:

Pango.Underline.NONE

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.underline_set
Name:

underline-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.variant
Name:

variant

Type:

Pango.Variant

Default Value:

Pango.Variant.NORMAL

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.variant_set
Name:

variant-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.weight
Name:

weight

Type:

int

Default Value:

400

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.weight_set
Name:

weight-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Gtk.CellRendererText.props.width_chars
Name:

width-chars

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.

Gtk.CellRendererText.props.wrap_mode
Name:

wrap-mode

Type:

Pango.WrapMode

Default Value:

Pango.WrapMode.CHAR

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.

Gtk.CellRendererText.props.wrap_width
Name:

wrap-width

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.