HOWTO: Set Main Application Font in PyGTK

Discussion in 'Python' started by Google Mike, Sep 2, 2004.

  1. Google Mike

    Google Mike Guest

    This was a tough one (at least for me), and wasn't exactly what I
    wanted when I was working on just setting on item's font, but shows
    how you can change the font for an entire PyGTK application. I
    stumbled on to it by accident.

    Once you have your widget as, say, variable 'w', do this:

    w.get_settings().set_string_property('gtk-font-name', 'sans normal
    9','');
    # some other font choices are:
    # courier bold 10
    # serif oblique 12
    # you get the idea?

    ....I know, I know, it doesn't make sense to me either, but once you
    attempt this on any widget in your project, the whole project changes
    its fonts. At least it does with my project. Note I did my project in
    Glade as one big Glade XML file, then loaded it in with PyGTK. I have
    RH9 Linux and I'm using the defaults with that, which I think is
    PyGTK2, Python 2.2, and Glade 2.

    Anyway, I hope this helps you. Now if anyone knows how to change the
    font and size on a single radio button in PyGTK, I welcome the
    suggestion. I don't think it can be done.
     
    Google Mike, Sep 2, 2004
    #1
    1. Advertising

  2. Google Mike

    Guest

    Google Mike wrote:
    > if anyone knows how to change the
    > font and size on a single radio button in PyGTK, I welcome the
    > suggestion. I don't think it can be done.


    You have read section 4 of the FAQ haven't you?
    http://www.async.com.br/faq/pygtk/index.py?req=index

    Pádraig.
     
    , Sep 2, 2004
    #2
    1. Advertising

  3. Google Mike

    Google Mike Guest

    Google Mike, Sep 2, 2004
    #3
  4. Google Mike

    Google Mike Guest

    Unfortunately, Pádraig, the main font change is the /only/ way to
    change the font on a radio button item. The FAQ also mentions that
    this is one of those things that cannot be changed individually.
    However, the rest of the FAQ was very enlightening and helped me
    complete my project, which was a user-friendly GUI front-end for
    PostgreSQL that's way better than phpAdmin III.
     
    Google Mike, Sep 5, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karl Hungus

    Font class, external font files question

    Karl Hungus, Feb 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    535
    Karl Hungus
    Feb 4, 2004
  2. =?Utf-8?B?Tmlja3k=?=
    Replies:
    2
    Views:
    716
    Matt Berther
    Feb 20, 2005
  3. Michael Glavitsch
    Replies:
    1
    Views:
    769
    Roedy Green
    Jul 15, 2003
  4. Andreas Otto

    HOWTO get the "Main-Class-Name" ?

    Andreas Otto, Mar 29, 2009, in forum: Java
    Replies:
    9
    Views:
    1,363
  5. mttc
    Replies:
    2
    Views:
    2,408
    Roedy Green
    Jul 3, 2009
Loading...

Share This Page