# Moving a GTK window

**URL:** <https://discourse.julialang.org/t/moving-a-gtk-window/85729>\
**Category:** General Usage\
**Tags:** question, package, gtk\
**Created:** [August 14, 2022, 2:37pm UTC](https://discourse.julialang.org/t/moving-a-gtk-window/85729 "2022-08-14T14:37:12Z")\
**Posts on this page:** 5\
**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:** [August 14, 2022, 2:37pm UTC](https://discourse.julialang.org/t/moving-a-gtk-window/85729/1 "2022-08-14T14:37:12Z")

</div>

I have the following code:

```julia
using Gtk.ShortNames, GtkObservables

# define the default values
OPTION_A = false
OPTION_B = false
finished = false 

cb1 = checkbox(OPTION_A, label="Option A")
cb2 = checkbox(OPTION_B, label="Option B")
btnOK = button(label="OK")

win = Window("Dialog", 200, 72) |> (bx = Box(:v))
push!(bx, cb1)
push!(bx, cb2)
push!(bx, btnOK)

function on_button_clicked(win)
    global OPTION_A, OPTION_B, finished, win
    OPTION_A = observable(cb1)[]
    OPTION_B = observable(cb2)[]
    destroy(win)
    finished = true
end
signal_connect(on_button_clicked, widget(btnOK), "clicked")

Gtk.showall(win)
G_.keep_above(win, true)
# G_.window_move(win, 100, 100)

while ! finished
    sleep(0.1)
end

println("Option A: $OPTION_A")
println("Option B: $OPTION_B")
nothing

```

The dialog always shows up when I run the script, which is fine.

But it sticks to the top of the screen. How can I move the window to a different position?

This function should do the trick: [Gtk.Window.move](https://docs.gtk.org/gtk3/method.Window.move.html)

But I could not find it, neither in the Gtk. namespace nor in the G\_. namespace.

Any idea how to move the window?

---

<div class="post-metadata">

**Author:** ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Post date:** [August 14, 2022, 3:16pm UTC](https://discourse.julialang.org/t/moving-a-gtk-window/85729/2 "2022-08-14T15:16:46Z")

</div>

G\_.position should do it.

---

<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:** [August 14, 2022, 3:48pm UTC](https://discourse.julialang.org/t/moving-a-gtk-window/85729/3 "2022-08-14T15:48:01Z")

</div>

Indeed,  
`G_.position(win, 800, 400)`  
works!

---

<div class="post-metadata">

**Author:** ![lobingera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lobingera/32/211_2.png) [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Post date:** [August 15, 2022, 3:49pm UTC](https://discourse.julialang.org/t/moving-a-gtk-window/85729/4 "2022-08-15T15:49:14Z")

</div>

do we know, what Glib/Gtk function is called with that?

---

<div class="post-metadata">

**Author:** ![tknopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tknopp/32/3569_2.png) [@tknopp](https://discourse.julialang.org/u/tknopp)\
**Post date:** [August 15, 2022, 4:40pm UTC](https://discourse.julialang.org/t/moving-a-gtk-window/85729/5 "2022-08-15T16:40:41Z")

</div>

> <https://github.com/JuliaGraphics/Gtk.jl/blob/543a4f13eabf6b62edb0c11c51a715219be37629/gen/gtk_get_set_gen.jl#L393>

🙂
