Search code examples
menupygtkfont-size

pygtk: How to change menu text size?


I'm trying to use PyGTK 2 in a touch environment, and the items in menus (popups) are too small. I found gtk.settings_get_for_screen and gtk.settings_get_default, and the gtk-font-name property, but changing that on either the default or the screen-specific settings didn't change the appearance of any of my text. Is there a style associated with menu items that I can change? Or is there some way of getting at the underlying text objects and using modify_font(pango.FontDescription('...')) on them?


Solution

  • If you use gtk.MenuItem, then you can apply modify_font (pango.FontDescription ('...')) for the get_child method.

    For example:

    item = gtk.MenuItem("item")
    child = item.get_child()
    child.modify_font(pango.FontDescription("sans 20"))