Gtk.TextTagTable

g GObject.GInterface GObject.GInterface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.Object GObject.Object Gtk.TextTagTable Gtk.TextTagTable GObject.Object->Gtk.TextTagTable Gtk.Buildable->Gtk.TextTagTable

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gtk.Buildable (1)

Structs:

GObject.ObjectClass (5)

class

new ()

add (tag)

foreach (func, *data)

get_size ()

lookup (name)

remove (tag)

Virtual Methods

Inherited:

GObject.Object (7), Gtk.Buildable (9)

Properties

None

Signals

Inherited:

GObject.Object (1)

Name

Short Description

tag-added

Emitted every time a new tag is added in the GtkTextTagTable.

tag-changed

Emitted every time a tag in the GtkTextTagTable changes.

tag-removed

Emitted every time a tag is removed from the GtkTextTagTable.

Fields

Inherited:

GObject.Object (1)

Class Details

class Gtk.TextTagTable(**kwargs)
Bases:

GObject.Object, Gtk.Buildable

Abstract:

No

The collection of tags in a GtkTextBuffer

You may wish to begin by reading the text widget conceptual overview, which gives an overview of all the objects and data types related to the text widget and how they work together.

GtkTextTagTables as Gtk.Buildable

The GtkTextTagTable implementation of the GtkBuildable interface supports adding tags by specifying “tag” as the “type” attribute of a <child> element.

An example of a UI definition fragment specifying tags: ``xml <object class=”GtkTextTagTable”>

<child type=”tag”>

<object class=”GtkTextTag”/>

</child>

</object> ``

classmethod new()[source]
Returns:

a new GtkTextTagTable

Return type:

Gtk.TextTagTable

Creates a new GtkTextTagTable.

The table contains no tags by default.

add(tag)[source]
Parameters:

tag (Gtk.TextTag) – a GtkTextTag

Returns:

True on success.

Return type:

bool

Add a tag to the table.

The tag is assigned the highest priority in the table.

tag must not be in a tag table already, and may not have the same name as an already-added tag.

foreach(func, *data)[source]
Parameters:

Calls func on each tag in self, with user data data.

Note that the table may not be modified while iterating over it (you can’t add/remove tags).

get_size()[source]
Returns:

number of tags in self

Return type:

int

Returns the size of the table (number of tags)

lookup(name)[source]
Parameters:

name (str) – name of a tag

Returns:

The tag

Return type:

Gtk.TextTag or None

Look up a named tag.

remove(tag)[source]
Parameters:

tag (Gtk.TextTag) – a GtkTextTag

Remove a tag from the table.

If a GtkTextBuffer has self as its tag table, the tag is removed from the buffer. The table’s reference to the tag is removed, so the tag will end up destroyed if you don’t have a reference to it.

Signal Details

Gtk.TextTagTable.signals.tag_added(text_tag_table, tag)
Signal Name:

tag-added

Flags:

RUN_LAST

Parameters:

Emitted every time a new tag is added in the GtkTextTagTable.

Gtk.TextTagTable.signals.tag_changed(text_tag_table, tag, size_changed)
Signal Name:

tag-changed

Flags:

RUN_LAST

Parameters:
  • text_tag_table (Gtk.TextTagTable) – The object which received the signal

  • tag (Gtk.TextTag) – the changed tag.

  • size_changed (bool) – whether the change affects the GtkTextView layout.

Emitted every time a tag in the GtkTextTagTable changes.

Gtk.TextTagTable.signals.tag_removed(text_tag_table, tag)
Signal Name:

tag-removed

Flags:

RUN_LAST

Parameters:

Emitted every time a tag is removed from the GtkTextTagTable.

The tag is still valid by the time the signal is emitted, but it is not associated with a tag table any more.