Clutter.Text

g Atk.ImplementorIface Atk.ImplementorIface Clutter.Actor Clutter.Actor Atk.ImplementorIface->Clutter.Actor Clutter.Text Clutter.Text Clutter.Actor->Clutter.Text Clutter.Animatable Clutter.Animatable Clutter.Animatable->Clutter.Actor Clutter.Container Clutter.Container Clutter.Container->Clutter.Actor Clutter.Scriptable Clutter.Scriptable Clutter.Scriptable->Clutter.Actor GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface GObject.GInterface->Clutter.Animatable GObject.GInterface->Clutter.Container GObject.GInterface->Clutter.Scriptable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Clutter.Actor GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned

Subclasses:

None

Methods

Inherited:

Clutter.Actor (238), GObject.Object (37), Clutter.Animatable (5), Clutter.Container (17), Clutter.Scriptable (4)

Structs:

GObject.ObjectClass (5)

class

new ()

class

new_full (font_name, text, color)

class

new_with_buffer (buffer)

class

new_with_text (font_name, text)

activate ()

coords_to_position (x, y)

delete_chars (n_chars)

delete_selection ()

delete_text (start_pos, end_pos)

get_activatable ()

get_attributes ()

get_buffer ()

get_chars (start_pos, end_pos)

get_color ()

get_cursor_color ()

get_cursor_position ()

get_cursor_rect ()

get_cursor_size ()

get_cursor_visible ()

get_editable ()

get_ellipsize ()

get_font_description ()

get_font_name ()

get_justify ()

get_layout ()

get_layout_offsets ()

get_line_alignment ()

get_line_wrap ()

get_line_wrap_mode ()

get_max_length ()

get_password_char ()

get_selectable ()

get_selected_text_color ()

get_selection ()

get_selection_bound ()

get_selection_color ()

get_single_line_mode ()

get_text ()

get_use_markup ()

insert_text (text, position)

insert_unichar (wc)

position_to_coords (position)

set_activatable (activatable)

set_attributes (attrs)

set_buffer (buffer)

set_color (color)

set_cursor_color (color)

set_cursor_position (position)

set_cursor_size (size)

set_cursor_visible (cursor_visible)

set_editable (editable)

set_ellipsize (mode)

set_font_description (font_desc)

set_font_name (font_name)

set_justify (justify)

set_line_alignment (alignment)

set_line_wrap (line_wrap)

set_line_wrap_mode (wrap_mode)

set_markup (markup)

set_max_length (max)

set_password_char (wc)

set_preedit_string (preedit_str, preedit_attrs, cursor_pos)

set_selectable (selectable)

set_selected_text_color (color)

set_selection (start_pos, end_pos)

set_selection_bound (selection_bound)

set_selection_color (color)

set_single_line_mode (single_line)

set_text (text)

set_use_markup (setting)

Virtual Methods

Inherited:

Clutter.Actor (35), GObject.Object (7), Clutter.Animatable (5), Clutter.Container (13), Clutter.Scriptable (4)

do_activate ()

do_cursor_changed ()

do_cursor_event (geometry)

do_text_changed ()

Properties

Inherited:

Clutter.Actor (82)

Name

Type

Flags

Short Description

activatable

bool

r/w

Whether pressing return causes the activate signal to be emitted

attributes

Pango.AttrList

r/w

A list of style attributes to apply to the contents of the actor

buffer

Clutter.TextBuffer

r/w

The buffer for the text

color

Clutter.Color

r/w

Color of the font used by the text

cursor-color

Clutter.Color

r/w

Cursor Color

cursor-color-set

bool

r

Whether the cursor color has been set

cursor-position

int

r/w

The cursor position

cursor-size

int

r/w

The width of the cursor, in pixels

cursor-visible

bool

r/w

Whether the input cursor is visible

editable

bool

r/w

Whether the text is editable

ellipsize

Pango.EllipsizeMode

r/w

The preferred place to ellipsize the string

font-description

Pango.FontDescription

r/w

The font description to be used

font-name

str

r/w

The font to be used by the text

justify

bool

r/w

Whether the text should be justified

line-alignment

Pango.Alignment

r/w

The preferred alignment for the string, for multi-line text

line-wrap

bool

r/w

If set, wrap the lines if the text becomes too wide

line-wrap-mode

Pango.WrapMode

r/w

Control how line-wrapping is done

max-length

int

r/w

Maximum length of the text inside the actor

password-char

int

r/w

If non-zero, use this character to display the actor’s contents

selectable

bool

r/w

Whether the text is selectable

selected-text-color

Clutter.Color

r/w

Selected Text Color

selected-text-color-set

bool

r

Whether the selected text color has been set

selection-bound

int

r/w

The cursor position of the other end of the selection

selection-color

Clutter.Color

r/w

Selection Color

selection-color-set

bool

r

Whether the selection color has been set

single-line-mode

bool

r/w

Whether the text should be a single line

text

str

r/w

The text to render

use-markup

bool

r/w

Whether or not the text includes Pango markup

Signals

Inherited:

Clutter.Actor (26), GObject.Object (1), Clutter.Container (3)

Name

Short Description

activate

The ::activate signal is emitted each time the actor is ‘activated’ by the user, normally by pressing the ‘Enter’ key.

cursor-changed

The ::cursor-changed signal is emitted whenever the cursor position or size changes.

cursor-event

The ::cursor-event signal is emitted whenever the cursor position changes inside a Clutter.Text actor. deprecated

delete-text

This signal is emitted when text is deleted from the actor by the user.

insert-text

This signal is emitted when text is inserted into the actor by the user.

text-changed

The ::text-changed signal is emitted after actor's text changes

Fields

Inherited:

Clutter.Actor (26), GObject.Object (1), Clutter.Container (3)

Name

Type

Access

Description

parent_instance

Clutter.Actor

r

Class Details

class Clutter.Text(**kwargs)
Bases:

Clutter.Actor

Abstract:

No

Structure:

Clutter.TextClass

The Clutter.Text struct contains only private data.

New in version 1.0.

classmethod new()
Returns:

the newly created Clutter.Text actor

Return type:

Clutter.Actor

Creates a new Clutter.Text actor. This actor can be used to display and edit text.

New in version 1.0.

classmethod new_full(font_name, text, color)
Parameters:
  • font_name (str) – a string with a font description

  • text (str) – the contents of the actor

  • color (Clutter.Color) – the color to be used to render text

Returns:

the newly created Clutter.Text actor

Return type:

Clutter.Actor

Creates a new Clutter.Text actor, using font_name as the font description; text will be used to set the contents of the actor; and color will be used as the color to render text.

This function is equivalent to calling Clutter.Text.new(), Clutter.Text.set_font_name(), Clutter.Text.set_text() and Clutter.Text.set_color().

New in version 1.0.

classmethod new_with_buffer(buffer)
Parameters:

buffer (Clutter.TextBuffer) – The buffer to use for the new Clutter.Text.

Returns:

a new Clutter.Text

Return type:

Clutter.Actor

Creates a new entry with the specified text buffer.

New in version 1.10.

classmethod new_with_text(font_name, text)
Parameters:
  • font_name (str or None) – a string with a font description

  • text (str) – the contents of the actor

Returns:

the newly created Clutter.Text actor

Return type:

Clutter.Actor

Creates a new Clutter.Text actor, using font_name as the font description; text will be used to set the contents of the actor.

This function is equivalent to calling Clutter.Text.new(), Clutter.Text.set_font_name(), and Clutter.Text.set_text().

New in version 1.0.

activate()
Returns:

True if the ::activate signal has been emitted, and False otherwise

Return type:

bool

Emits the Clutter.Text ::activate signal, if self has been set as activatable using Clutter.Text.set_activatable().

This function can be used to emit the ::activate signal inside a Clutter.Actor ::captured-event or Clutter.Actor ::key-press-event signal handlers before the default signal handler for the Clutter.Text is invoked.

New in version 1.0.

coords_to_position(x, y)
Parameters:
  • x (float) – the X coordinate, relative to the actor

  • y (float) – the Y coordinate, relative to the actor

Returns:

the position of the character

Return type:

int

Retrieves the position of the character at the given coordinates.

New in version 1.10.

delete_chars(n_chars)
Parameters:

n_chars (int) – the number of characters to delete

Deletes n_chars inside a Clutter.Text actor, starting from the current cursor position.

Somewhat awkwardly, the cursor position is decremented by the same number of characters you’ve deleted.

New in version 1.0.

delete_selection()
Returns:

True if text was deleted or if the text actor is empty, and False otherwise

Return type:

bool

Deletes the currently selected text

This function is only useful in subclasses of Clutter.Text

New in version 1.0.

delete_text(start_pos, end_pos)
Parameters:
  • start_pos (int) – starting position

  • end_pos (int) – ending position

Deletes the text inside a Clutter.Text actor between start_pos and end_pos.

The starting and ending positions are expressed in characters, not in bytes.

New in version 1.0.

get_activatable()
Returns:

True if the actor is activatable

Return type:

bool

Retrieves whether a Clutter.Text is activatable or not.

New in version 1.0.

get_attributes()
Returns:

the attribute list, or None if none was set. The returned value is owned by the Clutter.Text and should not be unreferenced.

Return type:

Pango.AttrList

Gets the attribute list that was set on the Clutter.Text actor Clutter.Text.set_attributes(), if any.

New in version 1.0.

get_buffer()
Returns:

A #GtkEntryBuffer object.

Return type:

Clutter.TextBuffer

Get the Clutter.TextBuffer object which holds the text for this widget.

New in version 1.10.

get_chars(start_pos, end_pos)
Parameters:
  • start_pos (int) – start of text, in characters

  • end_pos (int) – end of text, in characters

Returns:

a newly allocated string with the contents of the text actor between the specified positions. Use GLib.free() to free the resources when done

Return type:

str

Retrieves the contents of the Clutter.Text actor between start_pos and end_pos, but not including end_pos.

The positions are specified in characters, not in bytes.

New in version 1.0.

get_color()
Returns:

return location for a Clutter.Color

Return type:

color: Clutter.Color

Retrieves the text color as set by Clutter.Text.set_color().

New in version 1.0.

get_cursor_color()
Returns:

return location for a Clutter.Color

Return type:

color: Clutter.Color

Retrieves the color of the cursor of a Clutter.Text actor.

New in version 1.0.

get_cursor_position()
Returns:

the cursor position, in characters

Return type:

int

Retrieves the cursor position.

New in version 1.0.

get_cursor_rect()
Returns:

return location of a Clutter.Rect

Return type:

rect: Clutter.Rect

Retrieves the rectangle that contains the cursor.

The coordinates of the rectangle’s origin are in actor-relative coordinates.

New in version 1.16.

get_cursor_size()
Returns:

the size of the cursor, in pixels

Return type:

int

Retrieves the size of the cursor of a Clutter.Text actor.

New in version 1.0.

get_cursor_visible()
Returns:

True if the cursor is visible

Return type:

bool

Retrieves whether the cursor of a Clutter.Text actor is visible.

New in version 1.0.

get_editable()
Returns:

True if the actor is editable

Return type:

bool

Retrieves whether a Clutter.Text is editable or not.

New in version 1.0.

get_ellipsize()
Returns:

Pango.EllipsizeMode

Return type:

Pango.EllipsizeMode

Returns the ellipsizing position of a Clutter.Text actor, as set by Clutter.Text.set_ellipsize().

New in version 1.0.

get_font_description()
Returns:

a Pango.FontDescription. The returned value is owned by the Clutter.Text actor and it should not be modified or freed

Return type:

Pango.FontDescription

Retrieves the Pango.FontDescription used by self

New in version 1.2.

get_font_name()
Returns:

a string containing the font name. The returned string is owned by the Clutter.Text actor and should not be modified or freed

Return type:

str

Retrieves the font name as set by Clutter.Text.set_font_name().

New in version 1.0.

get_justify()
Returns:

True if the text should be justified

Return type:

bool

Retrieves whether the Clutter.Text actor should justify its contents on both margins.

New in version 0.6.

get_layout()
Returns:

a Pango.Layout. The returned object is owned by the Clutter.Text actor and should not be modified or freed

Return type:

Pango.Layout

Retrieves the current Pango.Layout used by a Clutter.Text actor.

New in version 1.0.

get_layout_offsets()
Returns:

x:

location to store X offset of layout, or None

y:

location to store Y offset of layout, or None

Return type:

(x: int, y: int)

Obtains the coordinates where the Clutter.Text will draw the Pango.Layout representing the text.

New in version 1.8.

get_line_alignment()
Returns:

a Pango.Alignment

Return type:

Pango.Alignment

Retrieves the alignment of a Clutter.Text, as set by Clutter.Text.set_line_alignment().

New in version 1.0.

get_line_wrap()
Returns:

True if the Clutter.Text actor should wrap its contents

Return type:

bool

Retrieves the value set using Clutter.Text.set_line_wrap().

New in version 1.0.

get_line_wrap_mode()
Returns:

the wrap mode used by the Clutter.Text

Return type:

Pango.WrapMode

Retrieves the line wrap mode used by the Clutter.Text actor.

See Clutter.Text.set_line_wrap_mode ().

New in version 1.0.

get_max_length()
Returns:

the maximum number of characters.

Return type:

int

Gets the maximum length of text that can be set into a text actor.

See Clutter.Text.set_max_length().

New in version 1.0.

get_password_char()
Returns:

a Unicode character or 0 if the password character is not set

Return type:

str

Retrieves the character to use in place of the actual text as set by Clutter.Text.set_password_char().

New in version 1.0.

get_selectable()
Returns:

True if the actor is selectable

Return type:

bool

Retrieves whether a Clutter.Text is selectable or not.

New in version 1.0.

get_selected_text_color()
Returns:

return location for a Clutter.Color

Return type:

color: Clutter.Color

Retrieves the color of selected text of a Clutter.Text actor.

New in version 1.8.

get_selection()
Returns:

a newly allocated string containing the currently selected text, or None. Use GLib.free() to free the returned string.

Return type:

str

Retrieves the currently selected text.

New in version 1.0.

get_selection_bound()
Returns:

the position of the other end of the selection

Return type:

int

Retrieves the other end of the selection of a Clutter.Text actor, in characters from the current cursor position.

New in version 1.0.

get_selection_color()
Returns:

return location for a Clutter.Color

Return type:

color: Clutter.Color

Retrieves the color of the selection of a Clutter.Text actor.

New in version 1.0.

get_single_line_mode()
Returns:

True if the Clutter.Text actor is in single line mode

Return type:

bool

Retrieves whether the Clutter.Text actor is in single line mode.

New in version 1.0.

get_text()
Returns:

the contents of the actor. The returned string is owned by the Clutter.Text actor and should never be modified or freed

Return type:

str

Retrieves a pointer to the current contents of a Clutter.Text actor.

If you need a copy of the contents for manipulating, either use GLib.strdup() on the returned string, or use:

copy = clutter_text_get_chars (text, 0, -1);

Which will return a newly allocated string.

If the Clutter.Text actor is empty, this function will return an empty string, and not None.

New in version 1.0.

get_use_markup()
Returns:

True if the contents will be parsed for markup

Return type:

bool

Retrieves whether the contents of the Clutter.Text actor should be parsed for the Pango text markup.

New in version 1.0.

insert_text(text, position)
Parameters:
  • text (str) – the text to be inserted

  • position (int) – the position of the insertion, or -1

Inserts text into a Clutter.Actor at the given position.

If position is a negative number, the text will be appended at the end of the current contents of the Clutter.Text.

The position is expressed in characters, not in bytes.

New in version 1.0.

insert_unichar(wc)
Parameters:

wc (str) – a Unicode character

Inserts wc at the current cursor position of a Clutter.Text actor.

New in version 1.0.

position_to_coords(position)
Parameters:

position (int) – position in characters

Returns:

True if the conversion was successful

x:

return location for the X coordinate, or None

y:

return location for the Y coordinate, or None

line_height:

return location for the line height, or None

Return type:

(bool, x: float, y: float, line_height: float)

Retrieves the coordinates of the given position.

New in version 1.0.

set_activatable(activatable)
Parameters:

activatable (bool) – whether the Clutter.Text actor should be activatable

Sets whether a Clutter.Text actor should be activatable.

An activatable Clutter.Text actor will emit the Clutter.Text ::activate signal whenever the ‘Enter’ (or ‘Return’) key is pressed; if it is not activatable, a new line will be appended to the current content.

An activatable Clutter.Text must also be set as editable using Clutter.Text.set_editable().

New in version 1.0.

set_attributes(attrs)
Parameters:

attrs (Pango.AttrList or None) – a Pango.AttrList or None to unset the attributes

Sets the attributes list that are going to be applied to the Clutter.Text contents.

The Clutter.Text actor will take a reference on the Pango.AttrList passed to this function.

New in version 1.0.

set_buffer(buffer)
Parameters:

buffer (Clutter.TextBuffer) – a Clutter.TextBuffer

Set the Clutter.TextBuffer object which holds the text for this widget.

New in version 1.10.

set_color(color)
Parameters:

color (Clutter.Color) – a Clutter.Color

Sets the color of the contents of a Clutter.Text actor.

The overall opacity of the Clutter.Text actor will be the result of the alpha value of color and the composited opacity of the actor itself on the scenegraph, as returned by Clutter.Actor.get_paint_opacity().

New in version 1.0.

set_cursor_color(color)
Parameters:

color (Clutter.Color or None) – the color of the cursor, or None to unset it

Sets the color of the cursor of a Clutter.Text actor.

If color is None, the cursor color will be the same as the text color.

New in version 1.0.

set_cursor_position(position)
Parameters:

position (int) – the new cursor position, in characters

Sets the cursor of a Clutter.Text actor at position.

The position is expressed in characters, not in bytes.

New in version 1.0.

set_cursor_size(size)
Parameters:

size (int) – the size of the cursor, in pixels, or -1 to use the default value

Sets the size of the cursor of a Clutter.Text. The cursor will only be visible if the Clutter.Text :cursor-visible property is set to True.

New in version 1.0.

set_cursor_visible(cursor_visible)
Parameters:

cursor_visible (bool) – whether the cursor should be visible

Sets whether the cursor of a Clutter.Text actor should be visible or not.

The color of the cursor will be the same as the text color unless Clutter.Text.set_cursor_color() has been called.

The size of the cursor can be set using Clutter.Text.set_cursor_size().

The position of the cursor can be changed programmatically using Clutter.Text.set_cursor_position().

New in version 1.0.

set_editable(editable)
Parameters:

editable (bool) – whether the Clutter.Text should be editable

Sets whether the Clutter.Text actor should be editable.

An editable Clutter.Text with key focus set using Clutter.Actor.grab_key_focus() or Clutter.Stage.set_key_focus() will receive key events and will update its contents accordingly.

New in version 1.0.

set_ellipsize(mode)
Parameters:

mode (Pango.EllipsizeMode) – a Pango.EllipsizeMode

Sets the mode used to ellipsize (add an ellipsis: “…”) to the text if there is not enough space to render the entire contents of a Clutter.Text actor

New in version 1.0.

set_font_description(font_desc)
Parameters:

font_desc (Pango.FontDescription) – a Pango.FontDescription

Sets font_desc as the font description for a Clutter.Text

The Pango.FontDescription is copied by the Clutter.Text actor so you can safely call Pango.FontDescription.free() on it after calling this function.

New in version 1.2.

set_font_name(font_name)
Parameters:

font_name (str or None) – a font name, or None to set the default font name

Sets the font used by a Clutter.Text. The font_name string must either be None, which means that the font name from the default Clutter.Backend will be used; or be something that can be parsed by the Pango.FontDescription.from_string() function, like:

// Set the font to the system's Sans, 10 points
clutter_text_set_font_name (text, "Sans 10");

// Set the font to the system's Serif, 16 pixels
clutter_text_set_font_name (text, "Serif 16px");

// Set the font to Helvetica, 10 points
clutter_text_set_font_name (text, "Helvetica 10");

New in version 1.0.

set_justify(justify)
Parameters:

justify (bool) – whether the text should be justified

Sets whether the text of the Clutter.Text actor should be justified on both margins. This setting is ignored if Clutter is compiled against Pango < 1.18.

New in version 1.0.

set_line_alignment(alignment)
Parameters:

alignment (Pango.Alignment) – A Pango.Alignment

Sets the way that the lines of a wrapped label are aligned with respect to each other. This does not affect the overall alignment of the label within its allocated or specified width.

To align a Clutter.Text actor you should add it to a container that supports alignment, or use the anchor point.

New in version 1.0.

set_line_wrap(line_wrap)
Parameters:

line_wrap (bool) – whether the contents should wrap

Sets whether the contents of a Clutter.Text actor should wrap, if they don’t fit the size assigned to the actor.

New in version 1.0.

set_line_wrap_mode(wrap_mode)
Parameters:

wrap_mode (Pango.WrapMode) – the line wrapping mode

If line wrapping is enabled (see Clutter.Text.set_line_wrap()) this function controls how the line wrapping is performed. The default is Pango.WrapMode.WORD which means wrap on word boundaries.

New in version 1.0.

set_markup(markup)
Parameters:

markup (str or None) – a string containing Pango markup. Passing None is the same as passing “” (the empty string)

Sets markup as the contents of a Clutter.Text.

This is a convenience function for setting a string containing Pango markup, and it is logically equivalent to:

/* the order is important */
clutter_text_set_text (CLUTTER_TEXT (actor), markup);
clutter_text_set_use_markup (CLUTTER_TEXT (actor), TRUE);

New in version 1.0.

set_max_length(max)
Parameters:

max (int) – the maximum number of characters allowed in the text actor; 0 to disable or -1 to set the length of the current string

Sets the maximum allowed length of the contents of the actor. If the current contents are longer than the given length, then they will be truncated to fit.

New in version 1.0.

set_password_char(wc)
Parameters:

wc (str) – a Unicode character, or 0 to unset the password character

Sets the character to use in place of the actual text in a password text actor.

If wc is 0 the text will be displayed as it is entered in the Clutter.Text actor.

New in version 1.0.

set_preedit_string(preedit_str, preedit_attrs, cursor_pos)
Parameters:
  • preedit_str (str or None) – the pre-edit string, or None to unset it

  • preedit_attrs (Pango.AttrList or None) – the pre-edit string attributes

  • cursor_pos (int) – the cursor position for the pre-edit string

Sets, or unsets, the pre-edit string. This function is useful for input methods to display a string (with eventual specific Pango attributes) before it is entered inside the Clutter.Text buffer.

The preedit string and attributes are ignored if the Clutter.Text actor is not editable.

This function should not be used by applications

New in version 1.2.

set_selectable(selectable)
Parameters:

selectable (bool) – whether the Clutter.Text actor should be selectable

Sets whether a Clutter.Text actor should be selectable.

A selectable Clutter.Text will allow selecting its contents using the pointer or the keyboard.

New in version 1.0.

set_selected_text_color(color)
Parameters:

color (Clutter.Color or None) – the selected text color, or None to unset it

Sets the selected text color of a Clutter.Text actor.

If color is None, the selected text color will be the same as the selection color, which then falls back to cursor, and then text color.

New in version 1.8.

set_selection(start_pos, end_pos)
Parameters:
  • start_pos (int) – start of the selection, in characters

  • end_pos (int) – end of the selection, in characters

Selects the region of text between start_pos and end_pos.

This function changes the position of the cursor to match start_pos and the selection bound to match end_pos.

New in version 1.0.

set_selection_bound(selection_bound)
Parameters:

selection_bound (int) – the position of the end of the selection, in characters

Sets the other end of the selection, starting from the current cursor position.

If selection_bound is -1, the selection unset.

New in version 1.0.

set_selection_color(color)
Parameters:

color (Clutter.Color or None) – the color of the selection, or None to unset it

Sets the color of the selection of a Clutter.Text actor.

If color is None, the selection color will be the same as the cursor color, or if no cursor color is set either then it will be the same as the text color.

New in version 1.0.

set_single_line_mode(single_line)
Parameters:

single_line (bool) – whether to enable single line mode

Sets whether a Clutter.Text actor should be in single line mode or not. Only editable Clutter.Text s can be in single line mode.

A text actor in single line mode will not wrap text and will clip the visible area to the predefined size. The contents of the text actor will scroll to display the end of the text if its length is bigger than the allocated width.

When setting the single line mode the Clutter.Text :activatable property is also set as a side effect. Instead of entering a new line character, the text actor will emit the Clutter.Text ::activate signal.

New in version 1.0.

set_text(text)
Parameters:

text (str or None) – the text to set. Passing None is the same as passing “” (the empty string)

Sets the contents of a Clutter.Text actor.

If the Clutter.Text :use-markup property was set to True it will be reset to False as a side effect. If you want to maintain the Clutter.Text :use-markup you should use the Clutter.Text.set_markup() function instead

New in version 1.0.

set_use_markup(setting)
Parameters:

setting (bool) – True if the text should be parsed for markup.

Sets whether the contents of the Clutter.Text actor contains markup in Pango’s text markup language.

Setting Clutter.Text :use-markup on an editable Clutter.Text will not have any effect except hiding the markup.

See also Clutter.Text :use-markup.

New in version 1.0.

do_activate() virtual
do_cursor_changed() virtual
do_cursor_event(geometry) virtual
Parameters:

geometry (Clutter.Geometry) –

do_text_changed() virtual

Signal Details

Clutter.Text.signals.activate(text)
Signal Name:

activate

Flags:

RUN_LAST

Parameters:

text (Clutter.Text) – The object which received the signal

The ::activate signal is emitted each time the actor is ‘activated’ by the user, normally by pressing the ‘Enter’ key. The signal is emitted only if Clutter.Text :activatable is set to True.

New in version 1.0.

Clutter.Text.signals.cursor_changed(text)
Signal Name:

cursor-changed

Flags:

RUN_LAST

Parameters:

text (Clutter.Text) – The object which received the signal

The ::cursor-changed signal is emitted whenever the cursor position or size changes.

New in version 1.16.

Clutter.Text.signals.cursor_event(text, geometry)
Signal Name:

cursor-event

Flags:

RUN_LAST, DEPRECATED

Parameters:

The ::cursor-event signal is emitted whenever the cursor position changes inside a Clutter.Text actor. Inside geometry it is stored the current position and size of the cursor, relative to the actor itself.

New in version 1.0.

Deprecated since version 1.16: Use the Clutter.Text ::cursor-changed signal instead

Clutter.Text.signals.delete_text(text, start_pos, end_pos)
Signal Name:

delete-text

Flags:

RUN_LAST, ACTION

Parameters:
  • text (Clutter.Text) – The object which received the signal

  • start_pos (int) – the starting position

  • end_pos (int) – the end position

This signal is emitted when text is deleted from the actor by the user. It is emitted before self text changes.

New in version 1.2.

Clutter.Text.signals.insert_text(text, new_text, new_text_length, position)
Signal Name:

insert-text

Flags:

RUN_LAST, ACTION

Parameters:
  • text (Clutter.Text) – The object which received the signal

  • new_text (str) – the new text to insert

  • new_text_length (int) – the length of the new text, in bytes, or -1 if new_text is nul-terminated

  • position (object or None) – the position, in characters, at which to insert the new text. this is an in-out parameter. After the signal emission is finished, it should point after the newly inserted text.

This signal is emitted when text is inserted into the actor by the user. It is emitted before self text changes.

New in version 1.2.

Clutter.Text.signals.text_changed(text)
Signal Name:

text-changed

Flags:

RUN_LAST

Parameters:

text (Clutter.Text) – The object which received the signal

The ::text-changed signal is emitted after actor's text changes

New in version 1.0.

Property Details

Clutter.Text.props.activatable
Name:

activatable

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Toggles whether return invokes the activate signal or not.

New in version 1.0.

Clutter.Text.props.attributes
Name:

attributes

Type:

Pango.AttrList

Default Value:

None

Flags:

READABLE, WRITABLE

A list of #PangoStyleAttribute s to be applied to the contents of the Clutter.Text actor.

New in version 1.0.

Clutter.Text.props.buffer
Name:

buffer

Type:

Clutter.TextBuffer

Default Value:

None

Flags:

READABLE, WRITABLE

The buffer which stores the text for this Clutter.Text.

If set to None, a default buffer will be created.

New in version 1.8.

Clutter.Text.props.color
Name:

color

Type:

Clutter.Color

Default Value:

<Color structure at 0x000000000000 (ClutterColor at 0x0000000)>

Flags:

READABLE, WRITABLE

The color used to render the text.

New in version 1.0.

Clutter.Text.props.cursor_color
Name:

cursor-color

Type:

Clutter.Color

Default Value:

<Color structure at 0x000000000000 (ClutterColor at 0x0000000)>

Flags:

READABLE, WRITABLE

The color of the cursor.

New in version 1.0.

Clutter.Text.props.cursor_color_set
Name:

cursor-color-set

Type:

bool

Default Value:

False

Flags:

READABLE

Will be set to True if Clutter.Text :cursor-color has been set.

New in version 1.0.

Clutter.Text.props.cursor_position
Name:

cursor-position

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

The current input cursor position. -1 is taken to be the end of the text

New in version 1.12.

Clutter.Text.props.cursor_size
Name:

cursor-size

Type:

int

Default Value:

2

Flags:

READABLE, WRITABLE

The size of the cursor, in pixels. If set to -1 the size used will be the default cursor size of 2 pixels.

New in version 1.0.

Clutter.Text.props.cursor_visible
Name:

cursor-visible

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether the input cursor is visible or not.

The cursor will only be visible if this property and either the Clutter.Text :editable or the Clutter.Text :selectable properties are set to True.

New in version 1.0.

Clutter.Text.props.editable
Name:

editable

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether key events delivered to the actor causes editing.

New in version 1.0.

Clutter.Text.props.ellipsize
Name:

ellipsize

Type:

Pango.EllipsizeMode

Default Value:

Pango.EllipsizeMode.NONE

Flags:

READABLE, WRITABLE

The preferred place to ellipsize the contents of the Clutter.Text actor

New in version 1.0.

Clutter.Text.props.font_description
Name:

font-description

Type:

Pango.FontDescription

Default Value:

None

Flags:

READABLE, WRITABLE

The Pango.FontDescription that should be used by the Clutter.Text

If you have a string describing the font then you should look at Clutter.Text :font-name instead

New in version 1.2.

Clutter.Text.props.font_name
Name:

font-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The font to be used by the Clutter.Text, as a string that can be parsed by Pango.FontDescription.from_string().

If set to None, the default system font will be used instead.

New in version 1.0.

Clutter.Text.props.justify
Name:

justify

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the contents of the Clutter.Text should be justified on both margins.

New in version 1.0.

Clutter.Text.props.line_alignment
Name:

line-alignment

Type:

Pango.Alignment

Default Value:

Pango.Alignment.LEFT

Flags:

READABLE, WRITABLE

The preferred alignment for the text. This property controls the alignment of multi-line paragraphs.

New in version 1.0.

Clutter.Text.props.line_wrap
Name:

line-wrap

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether to wrap the lines of Clutter.Text :text if the contents exceed the available allocation. The wrapping strategy is controlled by the Clutter.Text :line-wrap-mode property.

New in version 1.0.

Clutter.Text.props.line_wrap_mode
Name:

line-wrap-mode

Type:

Pango.WrapMode

Default Value:

Pango.WrapMode.WORD

Flags:

READABLE, WRITABLE

If Clutter.Text :line-wrap is set to True, this property will control how the text is wrapped.

New in version 1.0.

Clutter.Text.props.max_length
Name:

max-length

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

The maximum length of the contents of the Clutter.Text actor.

New in version 1.0.

Clutter.Text.props.password_char
Name:

password-char

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

If non-zero, the character that should be used in place of the actual text in a password text actor.

New in version 1.0.

Clutter.Text.props.selectable
Name:

selectable

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether it is possible to select text, either using the pointer or the keyboard.

This property depends on the Clutter.Actor :reactive property being set to True.

New in version 1.0.

Clutter.Text.props.selected_text_color
Name:

selected-text-color

Type:

Clutter.Color

Default Value:

<Color structure at 0x000000000000 (ClutterColor at 0x0000000)>

Flags:

READABLE, WRITABLE

The color of selected text.

New in version 1.8.

Clutter.Text.props.selected_text_color_set
Name:

selected-text-color-set

Type:

bool

Default Value:

False

Flags:

READABLE

Will be set to True if Clutter.Text :selected-text-color has been set.

New in version 1.8.

Clutter.Text.props.selection_bound
Name:

selection-bound

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

The current input cursor position. -1 is taken to be the end of the text

New in version 1.0.

Clutter.Text.props.selection_color
Name:

selection-color

Type:

Clutter.Color

Default Value:

<Color structure at 0x000000000000 (ClutterColor at 0x0000000)>

Flags:

READABLE, WRITABLE

The color of the selection.

New in version 1.0.

Clutter.Text.props.selection_color_set
Name:

selection-color-set

Type:

bool

Default Value:

False

Flags:

READABLE

Will be set to True if Clutter.Text :selection-color has been set.

New in version 1.0.

Clutter.Text.props.single_line_mode
Name:

single-line-mode

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the Clutter.Text actor should be in single line mode or not. A single line Clutter.Text actor will only contain a single line of text, scrolling it in case its length is bigger than the allocated size.

Setting this property will also set the Clutter.Text :activatable property as a side-effect.

The Clutter.Text :single-line-mode property is used only if the Clutter.Text :editable property is set to True.

New in version 1.0.

Clutter.Text.props.text
Name:

text

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE

The text to render inside the actor.

New in version 1.0.

Clutter.Text.props.use_markup
Name:

use-markup

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the text includes Pango markup.

For more informations about the Pango markup format, see Pango.Layout.set_markup() in the Pango documentation.

It is not possible to round-trip this property between True and False. Once a string with markup has been set on a Clutter.Text actor with :use-markup set to True, the markup is stripped from the string.

New in version 1.0.