Search code examples
pythonpython-2.7gtk3pango

How do I use Pango.AttrType.FOREGROUND in Python and Gtk3?


I am replacing some PyGtk code that looks like this :

pango.AttrForeground(65535, 0, 0, 0, 100)

Translating that to Gtk3 looks like this :

Pango.AttrType.FOREGROUND(65535, 0, 0, 0, 100)

However I get the error TypeError: 'AttrType' object is not callable. Googling seems to bring no results or then I searched for the wrong thing. Any ideas? Thank you very much.


Solution

  • Looking in the old PyGTK code it seems that pango.AttrForeground() wrapped the function pango_attr_foreground_new(). This function is marked non-introspectable in the GIR bindings, so it won't be available in the new Python libraries. I don't know the reason why; presumably there is some other way to do what the old code did.