pango.AttrIterator

pango.AttrIterator — an object pointing to a location in a pango.AttrList.

Synopsis

class pango.AttrIterator:
    def copy()
def range()
def next()
def get(type)
def get_font()
def get_attrs()

Description

The pango.AttrIterator object contains a pointer into a pango.AttrList. A pango.AttrIterator object is created using the pango.AttrList.get_iterator() method and then can be advanced through the attribute changes in the text using the next() method. The pango.AttrIterator object can access information about the current attributes applied at the iterator location (using the get() method) and the range of text that the current attribute change applies to (using the range() method).

The pango.AttrIterator object is only valid as long as the associated pango.AttrList is not changed.

Methods

pango.AttrIterator.copy

    def copy()

Returns :

a new pango.AttrIterator object

The copy() method returns a new pango.AttrIterator object that is a copy of this attribute iterator.

pango.AttrIterator.range

    def range()

Returns :

a 2-tuple containing the start and end index of the current attribute in the text.

The range() method returns a 2-tuple containing the start and end index of the application of the current attribute change in the text.

pango.AttrIterator.next

    def next()

Returns :

False if the iterator is at the end of the pango.AttrList.

The next() method advances the iterator to the next attribute change in its pango.AttrList. The next method returns False if the iterator is at the end of the pango.AttrList; otherwise, True.

pango.AttrIterator.get

    def get(type)

type :

the pango.Attribute type to find.

Returns :

the pango.Attribute matching type or None.

The get() method returns the pango.Attribute at the iterator location that matches the specified type. When multiple attributes of the same type overlap, the attribute whose range starts closest to the current location is returned. If no attribute matches, None is returned.

pango.AttrIterator.get_font

    def get_font()

Returns :

a 3-tuple containing a pango.FontDescription, a pango.Language and a list of non-font pango.Attribute objects at the current iterator location.

The get_font() method returns a 3-tuple containing a pango.FontDescription holding the current font attributes, a pango.Language object (if a language is set) or None and a list of non-font pango.Attribute objects in effect at the current iterator location.

pango.AttrIterator.get_attrs

    def get_attrs()

Returns :

a tuple containing the pango.Attribute objects in effect at the current iterator location.

Note

This method is available in PyGTK 2.4 and above.

The get_attrs() method returns a tuple containing the pango.Attribute objects in effect at the current iterator location.