AttrIterator#
- class AttrIterator(*args, **kwargs)#
A PangoAttrIterator is used to iterate through a PangoAttrList.
A new iterator is created with get_iterator.
Once the iterator is created, it can be advanced through the style
changes in the text using next. At each
style change, the range of the current style segment and the attributes
currently in effect can be queried.
Methods#
- class AttrIterator
-
- get(type: AttrType) Attribute | None#
Find the current attribute of a particular type at the iterator location.
When multiple attributes of the same type overlap, the attribute whose range starts closest to the current location is used.
- Parameters:
type – the type of attribute to find
- get_attrs() list[Attribute]#
Gets a list of all attributes at the current position of the iterator.
Added in version 1.2.
- get_font(desc: FontDescription) tuple[Language, list[Attribute]]#
Get the font and other attributes at the current iterator position.
- Parameters:
desc – a
PangoFontDescriptionto fill in with the current values. The family name in this structure will be set usingset_family_staticusing values from an attribute in thePangoAttrListassociated with the iterator, so if you plan to keep it around, you must call:pango_font_description_set_family (desc, pango_font_description_get_family (desc)).