Hello everyone
I need to make the tags in the text clickable, but before that I need to define these tags in a list
How can I get all the tags in the text?
Hi,
The question is not very clear…
Each buffer has a Gtk.TextTagTable
, with the list of all declared tags. You can get it with textbuffer.get_tag_table(), and loop over it with foreach.
But each tag in the TextTagTable can be applied multiple times on different ranges of the buffer. To loop over the ranges, you can:
- get the start iter of the buffer
- use iter.forward_to_tag_toggle() recursively to find the start and end iters of the ranges where the tag is applied
1 Like