10

Is it possible to apply this GTK+ theme in my PyGTK application?

Can I apply the theme programatically? Ie, to apply the theme do I use a PyGTK function or do I have to find where PyGTK is installed on my machine(Inside Python2.7) and change the arrow .pngs, and the scrollbar .pngs and etc.?

Note I only have PyGTK installed I dont have GTK+ installed, do I need that? Will the theme linked above work for PyGTK or only for GTK+?

Can you provide advice on how I can apply this theme to my PyGTK application?

sazr
  • 24,984
  • 66
  • 194
  • 362

1 Answers1

13

If you download the first package from your link, the one that's labelled "(GTK & Metacity themes)" you should get a tar.gz archive. Unpack the archive into some folder like /home/jake/.themes. Then in your pygtk code, before you initialize your widgets(I would do it right after you import pygtk and gtk in your code), add this line:

gtk.rc_parse('/home/jake/.themes/Elegant Brit/gtk-2.0/gtkrc')

That gtkrc file in that directory contains the information used to tell gtk how to draw the widgets for that theme.

Hope that helps.

Note: Theme choices should be left up to the user and it is generally frowned upon to change/modify the current user's theme when developing an application using gtk.

Wes
  • 954
  • 13
  • 25
  • +1 for the last paragraph and for being decent enough to write the paragraphs preceding it - I would have left them off ;-) – ptomato Jun 06 '12 at 16:06
  • IMO your note about not changing theme only applies for Linux - especially Gnome - users, no problem at all if you developing for Windows. – schlamar Jun 06 '12 at 16:07
  • @ms4py I generally agree with you, as gtk on windows is generally used for a very select number of applications and not an entire environment. But, nevertheless, it's how gtk was designed and the philosophy to keep in mind when developing gtk applications – Wes Jun 06 '12 at 16:44