gtk.CellRendererText
Prev | The gtk Class Reference | Next

## gtk.CellRendererText

gtk.CellRendererText — an object that renders text into a `gtk.TreeView` cell

## Synopsis

    class gtk.CellRendererText(gtk.CellRenderer):
        gtk.CellRendererText()
        def set_fixed_height_from_font(number_of_rows)

## Ancestry

    +-- gobject.GObject
      +-- gtk.Object
        +-- gtk.CellRenderer
          +-- gtk.CellRendererText

## gtk.CellRendererText Properties

gtk.Object Properties

gtk.CellRenderer Properties

"alignment" | Read/Write | Specifies how to align the lines of text using one of the Pango Alignment Constants Default value: `pango.ALIGN_LEFT`. Note that you probably need the 'xalign' property of `gtk.CellRenderer` if you want to set the horizontal alignment of the whole text. This property is available in GTK+ 2.10 and above.
"attributes" | Read/Write | A list of style attributes to apply to the text of the renderer.
"background" | Write | Background color as a string. Default: `None`
"background-gdk" | Read/Write | Background color as a gtk.gdk.Color
"background-set" | Read/Write | If `True` this tag affects the background color. Default: `False`
"editable" | Read/Write | If `True` the text can be modified by the user. GTK+ 2.4 and above. Default: `False`
"editable-set" | Read/Write | If `True` this tag affects the text editability. GTK+ 2.4 and above. Default: `False`
"ellipsize" | Read/Write | The preferred place to ellipsize the string, if the cell renderer does not have enough room to display the entire string, if at all. GTK+ 2.6 and above. Default: `pango.ELLIPSIZE_NONE`
"ellipsize-set" | Read/Write | If `True` this tag affects the text editability. Default: `False`
"family" | Read/Write | Name of the font family, e.g. Sans, Helvetica, Times, Monospace. Default: `None`
"family-set" | Read/Write | If `True` this tag affects the font family. Default: `False`
"font" | Read/Write | Font description as a string. Default: `None`
"font-desc" | Read/Write | Font description as a `pango.FontDescription`
"foreground" | Write | Foreground color as a string. Default: `None`
"foreground-gdk" | Read/Write | Foreground color as a `gtk.gdk.Color`
"foreground-set" | Read/Write | If `True` this tag affects the foreground color. Default: `False`
"language" | Read/Write | 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+ 2.4 and above. Default: `None`
"language-set" | Read/Write | If `True` this tag affects the language used to render the text. GTK+ 2.4 and above. Default: `False`
"markup" | Write | Marked up text to render. Default: `None`
"rise" | Read/Write | Offset of text above the baseline (below the baseline if rise is negative). Default: 0
"rise-set" | Read/Write | If `True` this tag affects the rise. Default: `False`
"scale" | Read/Write | Font scaling factor. Allowed values >= 0. Default: 1
"scale-set" | Read/Write | If `True` this tag scales the font. Default: `False`
"single-paragraph-mode" | Read/Write | If `True`, keep all text in a single paragraph. GTK+ 2.4 and above. Default: `False`
"size" | Read/Write | Font size. Allowed values >= 0. Default: 0
"size-points" | Read/Write | Font size in points. Allowed values >= 0. Default: 0
"size-set" | Read/Write | If `True` this tag affects the font size. Default: `False`
"stretch" | Read/Write | Font stretch. Default: `pango.STRETCH_NORMAL`
"stretch-set" | Read/Write | If `True` this tag affects the font stretch. Default: `False`
"strikethrough" | Read/Write | If `True` strike through the text. Default: `False`
"strikethrough-set" | Read/Write | If `True` this tag affects the strikethrough. Default: `False`
"style" | Read/Write | Font style. Default: `pango.STYLE_NORMAL`
"style-set" | Read/Write | If `True` this tag affects the font style. Default: `False`
"text" | Read/Write | Text to render. Default: `None`
"underline" | Read/Write | Style of underline for this text. Default: `pango.UNDERLINE_NONE`
"underline-set" | Read/Write | If `True` this tag affects the text underlining. Default: `False`
"variant" | Read/Write | Font variant. Default: `pango.VARIANT_NORMAL`
"variant-set" | Read/Write | If `True` this tag affects the font variant. Default: `False`
"weight" | Read/Write | Font weight. Allowed values >= 0. Default value: 400
"weight-set" | Read/Write | If `True` this tag affects the font weight. Default: `False`
"width-chars" | Read/Write | 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+ 2.6 and above. Allowed values >= -1. Default value: -1
"wrap-mode" | Read-Write | 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. This property is available in GTK+ 2.8 and above.
"wrap-width" | Read-Write | Specifies the 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. This property is available in GTK+ 2.8 and above.

## gtk.CellRendererText Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.CellRenderer Signal Prototypes

"edited" | `def callback(`cellrenderertext`, `path`, `new_text`, `user_param1`, `...`)`

## Description

The `gtk.CellRendererText` manages the rendering of text into a `gtk.TreeView` cell, using the font, color and style information provided by its properties. The text will be ellipsized if it is too long and the "ellipsize" property allows it.

## Constructor

        gtk.CellRendererText()

Returns : | the new cell renderer

Creates a new `gtk.CellRendererText`. The way that text is drawn is changed using object properties. The object properties can be set globally (with `set_property`()). 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`.

## Methods

### gtk.CellRendererText.set_fixed_height_from_font

        def set_fixed_height_from_font(number_of_rows)

`number_of_rows` : | Number of rows of text each cell renderer is allocated, or -1

The `set_fixed_height_from_font`() sets the height of a renderer to explicitly be determined by the "font" and "ypad" properties set on it. This method must be called each time these properties are changed to affect the height. This function is inflexible, and should really only be used if calculating the size of a cell is too slow (i.e. 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.

## Signals

### The "edited" gtk.CellRendererText Signal

        def callback(cellrenderertext, path, new_text, user_param1, ...)

`cellrenderertext` : | the cellrenderertext that received the "edited" signal
`path` : | the path string of the cellrenderertext
`new_text` : | the new text of the cellrenderertext
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)

The "edited" signal is emitted when the text in the cell has been edited.

Prev | Up | Next
gtk.CellRendererSpinner | Home | gtk.CellRendererToggle