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/WriteSpecifies 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/WriteA list of style attributes to apply to the text of the renderer.
"background"WriteBackground color as a string. Default: None
"background-gdk"Read/WriteBackground color as a gtk.gdk.Color
"background-set"Read/WriteIf True this tag affects the background color. Default: False
"editable"Read/WriteIf True the text can be modified by the user. GTK+ 2.4 and above. Default: False
"editable-set"Read/WriteIf True this tag affects the text editability. GTK+ 2.4 and above. Default: False
"ellipsize"Read/WriteThe 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/WriteIf True this tag affects the text editability. Default: False
"family"Read/WriteName of the font family, e.g. Sans, Helvetica, Times, Monospace. Default: None
"family-set"Read/WriteIf True this tag affects the font family. Default: False
"font"Read/WriteFont description as a string. Default: None
"font-desc"Read/WriteFont description as a pango.FontDescription
"foreground"WriteForeground color as a string. Default: None
"foreground-gdk"Read/WriteForeground color as a gtk.gdk.Color
"foreground-set"Read/WriteIf True this tag affects the foreground color. Default: False
"language"Read/WriteThe 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/WriteIf True this tag affects the language used to render the text. GTK+ 2.4 and above. Default: False
"markup"WriteMarked up text to render. Default: None
"rise"Read/WriteOffset of text above the baseline (below the baseline if rise is negative). Default: 0
"rise-set"Read/WriteIf True this tag affects the rise. Default: False
"scale"Read/WriteFont scaling factor. Allowed values >= 0. Default: 1
"scale-set"Read/WriteIf True this tag scales the font. Default: False
"single-paragraph-mode"Read/WriteIf True, keep all text in a single paragraph. GTK+ 2.4 and above. Default: False
"size"Read/WriteFont size. Allowed values >= 0. Default: 0
"size-points"Read/WriteFont size in points. Allowed values >= 0. Default: 0
"size-set"Read/WriteIf True this tag affects the font size. Default: False
"stretch"Read/WriteFont stretch. Default: pango.STRETCH_NORMAL
"stretch-set"Read/WriteIf True this tag affects the font stretch. Default: False
"strikethrough"Read/WriteIf True strike through the text. Default: False
"strikethrough-set"Read/WriteIf True this tag affects the strikethrough. Default: False
"style"Read/WriteFont style. Default: pango.STYLE_NORMAL
"style-set"Read/WriteIf True this tag affects the font style. Default: False
"text"Read/WriteText to render. Default: None
"underline"Read/WriteStyle of underline for this text. Default: pango.UNDERLINE_NONE
"underline-set"Read/WriteIf True this tag affects the text underlining. Default: False
"variant"Read/WriteFont variant. Default: pango.VARIANT_NORMAL
"variant-set"Read/WriteIf True this tag affects the font variant. Default: False
"weight"Read/WriteFont weight. Allowed values >= 0. Default value: 400
"weight-set"Read/WriteIf True this tag affects the font weight. Default: False
"width-chars"Read/WriteThe 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-WriteSpecifies 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-WriteSpecifies 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.