Am Mo, den 09.02.2004 schrieb David G. Mackay um 00:15:
> Is there a set of code snippets showing how to set font characteristics
> (size, slant, weight, etc.) under pango?  I found the section in the FAQ
> describing the markup capabilities, but that doesn't seem like it would
> apply to gtk.Entry widgets.  I couldn't find anything in the examples
> directory that seemed generally applicable to all widgets that utilize
> text, either.


pango.FontDescription is what you want:

import gtk
import pango

...

fd = pango.FontDescription()
fd.set_family("Serif")
fd.set_style(pango.STYLE_ITALIC)
fd.set_weight(pango.WEIGHT_BOLD)
fd.set_size(12 * pango.SCALE)


entry = gtk.Entry()
entry.modify_font(fd)

...

See
http://www.moeraki.com/pygtkreference/pygtk2reference/class-pangofontdescription.html
for more details.


Martin Grimme


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to