Change Gtk widget background/font/border color

Hi!

We are building a GUI with Gtk.jl and we are using Notebook widgets to organize pages, and we have a couple nested Notebooks in there. To help track which tab/page is active, I would like to color the background of the notebook pages with different colors, or at least the border, or at the very least the font of the label of the page.

I’ve had some very limited success, drawing inspiration from this with things like:

using Gtk, Gtk.ShortNames

win = Window("Test")
lbl = Label("Some text")
a = GtkFrame("test")
push!(win, a)
push!(a, lbl)
sc = Gtk.GAccessor.style_context(lbl) 
pr = CssProviderLeaf(data="GtkLabel {color:red}")  
push!(sc, StyleProvider(pr), 600)
showall(win)

that will color the text of the label lbl in red. But, changing to:

using Gtk, Gtk.ShortNames

win = Window("Test")
lbl = Label("Some text")
a = GtkFrame("test")
push!(win, a)
push!(a, lbl) 
sc1 = Gtk.GAccessor.style_context(a)  
pr1 = CssProviderLeaf(data="frame {color:green;}")
push!(sc1, StyleProvider(pr1), 600) 
showall(win)

now colors both the label of the tab of the notebook and the label in green. I’m obviously missing something. Adding:

using Gtk, Gtk.ShortNames

win = Window("Test")
lbl = Label("Some text")
a = GtkFrame("test")
push!(win, a)
push!(a, lbl)
sc = Gtk.GAccessor.style_context(lbl)
sc1 = Gtk.GAccessor.style_context(a) 
pr = CssProviderLeaf(data="label {color:red;}")
pr1 = CssProviderLeaf(data="frame {color:green;}")
push!(sc1, StyleProvider(pr1), 600)
push!(sc, StyleProvider(pr), 600)
showall(win)

does not help…
Any insight?
Finally, I still would rather color the background and not just the font…As far as I understand, it may not be possible for some widget types, which apparently can be remedied by adding them to a GtkEventBox, at least in Python, but I didn’t find an equivalent in Gtk.jl. I might be missing something here, too…

Anyways, thanks for any insight on these questions you guys might have!
Cheers,
Loic

Somewhere in the Gtk documentation (“drawing model”) there is a description, that some widgets don’t have an own window (rectangle managed by the display system) but draw on their parent. Notebook might be such a case. I remember that i didn’t find EventBox either, maybe you put an issue on Gtk.jl. For some special requests on Gtk drawing (i wanted a different frame in frame) it’s only possible by replacing the draw method by an own function - something easy in pygtk but i haven’t done in julia (but it should be straight forward).

That’s what I gathered.
Oh I see - I may dig up the draw function for the Notebook widget and see if I can tweak it. I lack some knowledge to do it originally…
I also opened an issue on Gtk.jl and will update here if something comes out of it.

http://www.pygtk.org/articles/cairo-pygtk-widgets/cairo-pygtk-widgets.htm

Oh nice. Thanks for sharing.