​Here's what I ended up doing, with the help of Denis Linvinus:

​
#!/usr/bin/python

from gi.repository import Gtk

mw = Gtk.Window()

prov = Gtk.CssProvider()
Gtk.StyleContext.add_provider_for_screen(mw.get_screen(),prov,Gtk.STYLE_PROVIDER_PRIORITY_USER)
prov.load_from_data("""
* {
    font: Serif 30;
    background-color: pink;
}
""")

mw.connect('delete-event',Gtk.main_quit)
mw.add(Gtk.Label('Hello Gtk %s!'%Gtk._version))
mw.show_all()
Gtk.main()

Note that it is possible to run several prov.load_from_data() calls to
interactively change the properties, e.g. based on some external event.

​Regards,
Dov
​


On Thu, Oct 10, 2013 at 4:16 PM, Paul Davis <p...@linuxaudiosystems.com>wrote:

>
>
>
> On Thu, Oct 10, 2013 at 4:05 AM, Dov Grobgeld <dov.grobg...@gmail.com>wrote:
>
>> Hi,
>>
>> Has something changed with the setting of styles in Gtk3, or is there
>> some environment setting that inhibits the setting of the style? Consider
>> the following python program:
>>
>> #!/usr/bin/python
>>
>> from gi.repository import Gtk
>>
>> Gtk.rc_parse_string("""
>> style "normal" {
>>     font_name ="serif 30"
>> }
>> widget "*" style "normal"
>> """)
>>
>
> My impression was that GTK RC files were deprecated (and ignored) and that
> all themeing/styling was done with CSS now. I may be wrong about that. Note
> that it isn't trivial to do per-widget CSS stuff, apparently.
>
>
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to