[pygtk] Font size

Frédéric frederic.mantegazza at gbiloba.org
Wed Dec 10 23:35:46 WST 2008


Le 10/12/2008, "Gian Mario Tagliaretti" <gianmt at gnome.org> a écrit:

>you could use (if I got your question right) the pango markup for that:
>http://library.gnome.org/devel/pango/unstable/PangoMarkupFormat.html

Ok, I finally found how to do that:

    def _setFontParams(self, widget, scale=None, weight=None):
        context = widget.get_pango_context()
        font = context.get_font_description()
        if scale is not None:
            font.set_size(int(font.get_size() * scale))
        if weight is not None:
            font.set_weight(weight)
        widget.modify_font(font)

where weight can be something like pango.WEIGHT_BOLD...

BTW, wher do I put the .gtkrc-2.0 file under windows? I tried under:

    C:\\Document and Settings\<user>\Application Data\gtk-2.0\gtkrc

but it does not work...

--
   Frédéric


More information about the pygtk mailing list