:right-sidebar: True TextTagTable =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: TextTagTable(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.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 ```` element. An example of a UI definition fragment specifying tags: .. code-block:: :dedent: Constructors ------------ .. rst-class:: interim-class .. class:: TextTagTable :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.TextTagTable Creates a new ``GtkTextTagTable``. The table contains no tags by default. Methods ------- .. rst-class:: interim-class .. class:: TextTagTable :no-index: .. method:: add(tag: ~gi.repository.Gtk.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. :param tag: a ``GtkTextTag`` .. method:: foreach(func: ~typing.Callable[[...], None], *data: ~typing.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). :param func: a function to call on each tag :param data: user data .. method:: get_size() -> int Returns the size of the table (number of tags) .. method:: lookup(name: str) -> ~gi.repository.Gtk.TextTag | None Look up a named tag. :param name: name of a tag .. method:: remove(tag: ~gi.repository.Gtk.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. :param tag: a ``GtkTextTag`` Signals ------- .. rst-class:: interim-class .. class:: TextTagTable.signals :no-index: .. method:: tag_added(tag: ~gi.repository.Gtk.TextTag) -> None Emitted every time a new tag is added in the ``GtkTextTagTable``. :param tag: the added tag. .. method:: tag_changed(tag: ~gi.repository.Gtk.TextTag, size_changed: bool) -> None Emitted every time a tag in the ``GtkTextTagTable`` changes. :param tag: the changed tag. :param size_changed: whether the change affects the ``GtkTextView`` layout. .. method:: tag_removed(tag: ~gi.repository.Gtk.TextTag) -> None 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. :param tag: the removed tag.