How can I change the font size of a label in Gtk4.jl?
I have the following code:
using Gtk4
win = GtkWindow("My First Gtk4.jl Program", 400, 200)
hbox = GtkBox(:h) # :h makes a horizontal layout, :v a vertical layout
push!(win, hbox)
label = GtkLabel(" Power:")
value = GtkLabel(" 22.4")
push!(hbox, label)
push!(hbox, value)
hbox.spacing = 10
hbox.homogeneous = true
show(win)
nothing
and the text is way too small…
OK, this works:
win = GtkWindow("My First Gtk4.jl Program", 400, 200)
css = """
button {
font-size: 3.0em;
}
"""
cssProvider = GtkCssProvider(css)
push!(Gtk4.display(win), cssProvider)
hbox = GtkBox(:h) # :h makes a horizontal layout, :v a vertical layout
push!(win, hbox)
label = GtkButton(" Power:")
value = GtkButton(" 22.4")
push!(hbox, label)
push!(hbox, value)
hbox.spacing = 10
hbox.homogeneous = true
show(win)
nothing
But it does NOT work when I use GtkLabel
instead of GtkButton
…
Guess that’s a bug, then…
This works:
win = GtkWindow("My First Gtk4.jl Program", 400, 200)
css = """
label {
font-size: 3.0em;
}
"""
cssProvider = GtkCssProvider(css)
push!(Gtk4.display(win), cssProvider)
hbox = GtkBox(:h) # :h makes a horizontal layout, :v a vertical layout
push!(win, hbox)
label = GtkLabel(" Power:")
value = GtkLabel(" 22.4")
push!(hbox, label)
push!(hbox, value)
hbox.spacing = 10
hbox.homogeneous = true
show(win)
nothing
Sorry for the noise…