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