| FAQ Index - Search - Recent Changes - Everything - Add entry |
4.11. How can I create a new pango context()
Q: How can I create a new, or copy an existing, pango context? I am
currently using the context returned by widget.get_pango_context(), but I can't work out how to make a new one. If I use the one attached to the widget I have to restore everything after every use.
A: widget.create_pango_context() should give you a new one.
Note that pango.Context() doesn't work: PangoContext is really an abstract interface. There are currently context implementations for core X fonts (already removed from the HEAD branch), Xft, Win32 and freetype. Widget.create_pango_context() will create a context appropriate for use with that widget, so you don't need to worry about these details.
