Gtk.CellRendererText - Classes - Gtk 3.0 (original) (raw)

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 (25), GObject.Object (37)

Structs:

Gtk.CellRendererClass (1), GObject.ObjectClass (5)

class new ()
set_fixed_height_from_font (number_of_rows)

Virtual Methods

Inherited:

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

do_edited (path, new_text)

Properties

Inherited:

Gtk.CellRenderer (16)

Name Type Flags Short Description
align-set bool r/w Whether this tag affects the alignment mode
alignment Pango.Alignment r/w/en How to align the lines
attributes Pango.AttrList r/w A list of style attributes to apply to the text of the renderer
background str w Background color as a string
background-gdk Gdk.Color d/r/w Background color as a Gdk.Color deprecated
background-rgba Gdk.RGBA r/w Background color as a Gdk.RGBA
background-set bool r/w Whether this tag affects the background color
editable bool r/w Whether the text can be modified by the user
editable-set bool r/w Whether this tag affects text editability
ellipsize Pango.EllipsizeMode r/w/en The preferred place to ellipsize the string, if the cell renderer does not have enough room to display the entire string
ellipsize-set bool r/w Whether this tag affects the ellipsize mode
family str r/w Name of the font family, e.g. Sans, Helvetica, Times, Monospace
family-set bool r/w Whether this tag affects the font family
font str r/w Font description as a string, e.g. “Sans Italic 12”
font-desc Pango.FontDescription r/w Font description as a Pango.FontDescription struct
foreground str w Foreground color as a string
foreground-gdk Gdk.Color d/r/w Foreground color as a Gdk.Color deprecated
foreground-rgba Gdk.RGBA r/w Foreground color as a Gdk.RGBA
foreground-set bool r/w Whether this tag affects the foreground color
language str r/w The language this text is in, as an ISO code. Pango can use this as a hint when rendering the text. If you don’t understand this parameter, you probably don’t need it
language-set bool r/w Whether this tag affects the language the text is rendered as
markup str w Marked up text to render
max-width-chars int r/w/en The maximum width of the cell, in characters
placeholder-text str r/w Text rendered when an editable cell is empty
rise int r/w Offset of text above the baseline (below the baseline if rise is negative)
rise-set bool r/w Whether this tag affects the rise
scale float r/w Font scaling factor
scale-set bool r/w Whether this tag scales the font size by a factor
single-paragraph-mode bool r/w/en Whether to keep all text in a single paragraph
size int r/w Font size
size-points float r/w Font size in points
size-set bool r/w Whether this tag affects the font size
stretch Pango.Stretch r/w Font stretch
stretch-set bool r/w Whether this tag affects the font stretch
strikethrough bool r/w Whether to strike through the text
strikethrough-set bool r/w Whether this tag affects strikethrough
style Pango.Style r/w Font style
style-set bool r/w Whether this tag affects the font style
text str r/w Text to render
underline Pango.Underline r/w Style of underline for this text
underline-set bool r/w Whether this tag affects underlining
variant Pango.Variant r/w Font variant
variant-set bool r/w Whether this tag affects the font variant
weight int r/w Font weight
weight-set bool r/w Whether this tag affects the font weight
width-chars int r/w/en The desired width of the label, in characters
wrap-mode Pango.WrapMode r/w/en How to break the string into multiple lines, if the cell renderer does not have enough room to display the entire string
wrap-width int r/w/en The width at which the text is wrapped

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

A Gtk.CellRendererText 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 Gtk.CellRendererText :ellipsize property allows it.

If the Gtk.CellRenderer :mode is Gtk.CellRendererMode.EDITABLE, the Gtk.CellRendererText allows to edit its text using an entry.

classmethod new()[source]

Returns:

the new cell renderer

Return type:

Gtk.CellRenderer

Creates a new Gtk.CellRendererText. Adjust how text is drawn using object properties. Object properties can be set globally (with g_object_set()). Also, with Gtk.TreeViewColumn, you can bind a property to a value in a Gtk.TreeModel. 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 Gtk.TreeView

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 unflexible, 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.

do_edited(path, new_text) virtual

Parameters:

Signal Details

Gtk.CellRendererText.signals.edited(cell_renderer_text, path, new_text)

Signal Name:

edited

Flags:

RUN_LAST

Parameters:

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

Whether this tag affects the alignment mode

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 Gtk.CellRenderer, on the other hand, sets the horizontal alignment of the whole text.

New in version 2.10.

Gtk.CellRendererText.props.attributes

Name:

attributes

Type:

Pango.AttrList

Default Value:

None

Flags:

READABLE, WRITABLE

A list of style attributes to apply to the text of the renderer

Gtk.CellRendererText.props.background

Name:

background

Type:

str

Default Value:

None

Flags:

WRITABLE

Background color as a string

Gtk.CellRendererText.props.background_gdk

Name:

background-gdk

Type:

Gdk.Color

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE

Background color as a Gdk.Color

Deprecated since version 3.4: Use Gtk.CellRendererText :background-rgba instead.

Gtk.CellRendererText.props.background_rgba

Name:

background-rgba

Type:

Gdk.RGBA

Default Value:

None

Flags:

READABLE, WRITABLE

Background color as a Gdk.RGBA

New in version 3.0.

Gtk.CellRendererText.props.background_set

Name:

background-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects the background color

Gtk.CellRendererText.props.editable

Name:

editable

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the text can be modified by the user

Gtk.CellRendererText.props.editable_set

Name:

editable-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects text editability

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

New in version 2.6.

Gtk.CellRendererText.props.ellipsize_set

Name:

ellipsize-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects the ellipsize mode

Gtk.CellRendererText.props.family

Name:

family

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Name of the font family, e.g. Sans, Helvetica, Times, Monospace

Gtk.CellRendererText.props.family_set

Name:

family-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects the font family

Gtk.CellRendererText.props.font

Name:

font

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Font description as a string, e.g. “Sans Italic 12”

Gtk.CellRendererText.props.font_desc

Name:

font-desc

Type:

Pango.FontDescription

Default Value:

None

Flags:

READABLE, WRITABLE

Font description as a Pango.FontDescription struct

Gtk.CellRendererText.props.foreground

Name:

foreground

Type:

str

Default Value:

None

Flags:

WRITABLE

Foreground color as a string

Gtk.CellRendererText.props.foreground_gdk

Name:

foreground-gdk

Type:

Gdk.Color

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE

Foreground color as a Gdk.Color

Deprecated since version 3.4: Use Gtk.CellRendererText :foreground-rgba instead.

Gtk.CellRendererText.props.foreground_rgba

Name:

foreground-rgba

Type:

Gdk.RGBA

Default Value:

None

Flags:

READABLE, WRITABLE

Foreground color as a Gdk.RGBA

New in version 3.0.

Gtk.CellRendererText.props.foreground_set

Name:

foreground-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects the foreground color

Gtk.CellRendererText.props.language

Name:

language

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The language this text is in, as an ISO code. Pango can use this as a hint when rendering the text. If you don’t understand this parameter, you probably don’t need it

Gtk.CellRendererText.props.language_set

Name:

language-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects the language the text is rendered as

Gtk.CellRendererText.props.markup

Name:

markup

Type:

str

Default Value:

None

Flags:

WRITABLE

Marked up text to render

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 Gtk.CellLayout and all of the cell’s siblings have received their natural width.

New in version 3.0.

Gtk.CellRendererText.props.placeholder_text

Name:

placeholder-text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The text that will be displayed in the Gtk.CellRenderer ifGtk.CellRendererText :editable is True and the cell is empty.

New in version 3.6.

Gtk.CellRendererText.props.rise

Name:

rise

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Offset of text above the baseline (below the baseline if rise is negative)

Gtk.CellRendererText.props.rise_set

Name:

rise-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects the rise

Gtk.CellRendererText.props.scale

Name:

scale

Type:

float

Default Value:

1.0

Flags:

READABLE, WRITABLE

Font scaling factor

Gtk.CellRendererText.props.scale_set

Name:

scale-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag scales the font size by a factor

Gtk.CellRendererText.props.single_paragraph_mode

Name:

single-paragraph-mode

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to keep all text in a single paragraph

Gtk.CellRendererText.props.size

Name:

size

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Font size

Gtk.CellRendererText.props.size_points

Name:

size-points

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

Font size in points

Gtk.CellRendererText.props.size_set

Name:

size-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects the font size

Gtk.CellRendererText.props.stretch

Name:

stretch

Type:

Pango.Stretch

Default Value:

Pango.Stretch.NORMAL

Flags:

READABLE, WRITABLE

Font stretch

Gtk.CellRendererText.props.stretch_set

Name:

stretch-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects the font stretch

Gtk.CellRendererText.props.strikethrough

Name:

strikethrough

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether to strike through the text

Gtk.CellRendererText.props.strikethrough_set

Name:

strikethrough-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects strikethrough

Gtk.CellRendererText.props.style

Name:

style

Type:

Pango.Style

Default Value:

Pango.Style.NORMAL

Flags:

READABLE, WRITABLE

Font style

Gtk.CellRendererText.props.style_set

Name:

style-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects the font style

Gtk.CellRendererText.props.text

Name:

text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Text to render

Gtk.CellRendererText.props.underline

Name:

underline

Type:

Pango.Underline

Default Value:

Pango.Underline.NONE

Flags:

READABLE, WRITABLE

Style of underline for this text

Gtk.CellRendererText.props.underline_set

Name:

underline-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects underlining

Gtk.CellRendererText.props.variant

Name:

variant

Type:

Pango.Variant

Default Value:

Pango.Variant.NORMAL

Flags:

READABLE, WRITABLE

Font variant

Gtk.CellRendererText.props.variant_set

Name:

variant-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects the font variant

Gtk.CellRendererText.props.weight

Name:

weight

Type:

int

Default Value:

400

Flags:

READABLE, WRITABLE

Font weight

Gtk.CellRendererText.props.weight_set

Name:

weight-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether this tag affects the font weight

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.

New in version 2.6.

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.

New in version 2.8.

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.

New in version 2.8.