Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I recently noticed that monodevelop, can change GTK theme in runtime . How do I add it in my quickly app?

share|improve this question
    
Please dont! A single theme for all apps is an important part of good usability. Individual apps should not change the theme themselfs. –  xubuntix Oct 4 '12 at 7:29
    
@xubuntix: Thanks but I know that , but I wanna let the user to chose favourate theme (Iff they wish) for my app(as in mono develop) –  Tachyons Oct 5 '12 at 15:05
add comment

2 Answers

If you want, you can check out my Blog Post on Python, GTK and CSS

I tried to do a little write-up on how to do it (I used it for my quickly app as well).

share|improve this answer
add comment

You can use Gtk.CssProvidor to load a css file. For example:

css_provider = Gtk.CssProvider()
css_provider.load_from_file("file_name.css")
screen = Gdk.Screen.get_default()
style_context = window.get_style_context()
style_context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)

Where "file_name.css" is the css file you want to load (the themes in ubuntu seem to be in /usr/share/themes/THEME_NAME/gtk-3.0/) and window is the window widget you are using. If you want to load css from a string you can use css_provider.load_from_data(string_name.encode('UTF-8')) instead of css_provider.load_from_file("file_name.css")

Resources:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.