Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > HOWTO: Set Main Application Font in PyGTK

Reply
Thread Tools

HOWTO: Set Main Application Font in PyGTK

 
 
Google Mike
Guest
Posts: n/a
 
      09-02-2004
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.
 
Reply With Quote
 
 
 
 
P@draigBrady.com
Guest
Posts: n/a
 
      09-02-2004
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.
 
Reply With Quote
 
 
 
 
Google Mike
Guest
Posts: n/a
 
      09-02-2004
> You have read section 4 of the FAQ haven't you?
> http://www.async.com.br/faq/pygtk/index.py?req=index
>
> Pádraig.


This was extremely useful and had much more information that I found
useful than I expected! Why hadn't I known about it sooner??
 
Reply With Quote
 
Google Mike
Guest
Posts: n/a
 
      09-05-2004
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Swing Font, it's Java Font? ot native? how install new font? mttc Java 2 07-03-2009 07:29 PM
int main() or int main(void)? Frederick Ding C Programming 10 12-04-2005 12:44 AM
adding main.aspx.vb & main.aspx.resx under aspx John M ASP .Net 1 05-29-2005 09:27 PM
int main(int argc, char *argv[] ) vs int main(int argc, char **argv ) Hal Styli C Programming 14 01-20-2004 10:00 PM



Advertisments