Re: Setting styles in Gtk 3.0
- From: Dov Grobgeld <dov grobgeld gmail com>
- To: Paul Davis <paul linuxaudiosystems com>
- Cc: Gnome List <gtk-list gnome org>
- Subject: Re: Setting styles in Gtk 3.0
- Date: Thu, 10 Oct 2013 15:53:57 +0200
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]