TextTagTable#

class TextTagTable(**properties: Any)#

Superclasses: Object

Implemented Interfaces: Buildable

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 GtkBuildable#

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:

<object class="GtkTextTagTable">
 <child type="tag">
   <object class="GtkTextTag"/>
 </child>
</object>

Constructors#

class TextTagTable
classmethod new() TextTagTable#

Creates a new GtkTextTagTable.

The table contains no tags by default.

Methods#

class TextTagTable
add(tag: TextTag) 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.

Parameters:

tag – a GtkTextTag

foreach(func: Callable[[...], None], *data: Any) None#

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

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

Parameters:
  • func – a function to call on each tag

  • data – user data

get_size() int#

Returns the size of the table (number of tags)

lookup(name: str) TextTag | None#

Look up a named tag.

Parameters:

name – name of a tag

remove(tag: TextTag) None#

Remove a tag from the table.

If a GtkTextBuffer has table 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.

Parameters:

tag – a GtkTextTag

Signals#

class TextTagTable.signals
tag_added(tag: TextTag) None#

The type of the None singleton.

Parameters:

tag – the added tag.

tag_changed(tag: TextTag, size_changed: bool) None#

The type of the None singleton.

Parameters:
  • tag – the changed tag.

  • size_changed – whether the change affects the GtkTextView layout.

tag_removed(tag: TextTag) None#

The type of the None singleton.

Parameters:

tag – the removed tag.