# Toggling visibility of widget is effective only after starting the Gtk loop

**URL:** <https://discourse.julialang.org/t/toggling-visibility-of-widget-is-effective-only-after-starting-the-gtk-loop/67086>\
**Category:** General Usage\
**Tags:** gtk\
**Created:** [August 27, 2021, 8:45am UTC](https://discourse.julialang.org/t/toggling-visibility-of-widget-is-effective-only-after-starting-the-gtk-loop/67086 "2021-08-27T08:45:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [August 27, 2021, 8:45am UTC](https://discourse.julialang.org/t/toggling-visibility-of-widget-is-effective-only-after-starting-the-gtk-loop/67086/1 "2021-08-27T08:45:33Z")

</div>

I would like to start a [`Gtk.jl`](https://juliagraphics.github.io/Gtk.jl/latest/) window with two buttons, one of them being invisible; the visible button toggles the visibility of the invisible one.

I cannot set the visibility of the “invisible” button until after I start the Gtk main loop. Setting other properties, such as `label` before the main loop instead works as expected.

Is this a bug?

```julia
using Gtk

win = GtkWindow("Visible buttons")

b1 = GtkCheckButton("Click Me")
#set_gtk_property!(b1, :label, "Button 1")
b2 = GtkButton("This button disappears")
set_gtk_property!(b2, :visible, false)

signal_connect(b1, "clicked") do w
    set_gtk_property!(b2,
                      :visible, get_gtk_property(w, :active, Bool))
end

g = GtkGrid()
g[1,1] = b1
g[2,1] = b2

push!(win, g)
showall(win)
#set_gtk_property!(b2, :visible, false) # uncomment this to hide the button b2

```
