# Change font size in Gtk4.jl

**URL:** <https://discourse.julialang.org/t/change-font-size-in-gtk4-jl/112223>\
**Category:** General Usage\
**Tags:** question, package, gtk4\
**Created:** [March 28, 2024, 9:12am UTC](https://discourse.julialang.org/t/change-font-size-in-gtk4-jl/112223 "2024-03-28T09:12:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 28, 2024, 9:12am UTC](https://discourse.julialang.org/t/change-font-size-in-gtk4-jl/112223/1 "2024-03-28T09:12:32Z")

</div>

How can I change the font size of a label in Gtk4.jl?

I have the following code:

```julia
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…

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 28, 2024, 9:36am UTC](https://discourse.julialang.org/t/change-font-size-in-gtk4-jl/112223/2 "2024-03-28T09:36:44Z")

</div>

OK, this works:

```julia
    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…

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 28, 2024, 9:41am UTC](https://discourse.julialang.org/t/change-font-size-in-gtk4-jl/112223/3 "2024-03-28T09:41:01Z")

</div>

This works:

```julia
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…
