Question

I guess that for this used foreach() function, but can't understand how its works.

Was it helpful?

Solution

This is an example of how to use the foreach method of Gtk.TextTagTable:

tagtable = self.textbuffer.props.tag_table

def foreach_func(tag, data):
    print tag.props.name

tagtable.foreach(foreach_func, None)

Remember that you cannot modify the tagtable while iterating over it, so you cannot delete a tag within your foreach_func

OTHER TIPS

You can run a loop through the table like:

for iterating_var in sequence:
   statements(s)
   # Do something
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top