# Gtk GUI + returning a value from a function

**URL:** <https://discourse.julialang.org/t/gtk-gui-returning-a-value-from-a-function/108299>\
**Category:** General Usage\
**Tags:** gtk, gui\
**Created:** [January 3, 2024, 12:38pm UTC](https://discourse.julialang.org/t/gtk-gui-returning-a-value-from-a-function/108299 "2024-01-03T12:38:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AdamWysokinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adamwysokinski/32/206422_2.png) [@AdamWysokinski](https://discourse.julialang.org/u/AdamWysokinski)\
**Post date:** [January 3, 2024, 12:38pm UTC](https://discourse.julialang.org/t/gtk-gui-returning-a-value-from-a-function/108299/1 "2024-01-03T12:38:21Z")

</div>

Hi,

I’m using Gtk to display GUI inside my function. I’d like the function to return a value generated in that GUI, e.g. Gtk.GtkSpinButton value. How can this be done? I need to keep the window open until the value is set and confirmed by the user and then to close the window and return the value.

ATB,  
Adam

---

<div class="post-metadata">

**Author:** ![AdamWysokinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adamwysokinski/32/206422_2.png) [@AdamWysokinski](https://discourse.julialang.org/u/AdamWysokinski)\
**Post date:** [January 3, 2024, 12:53pm UTC](https://discourse.julialang.org/t/gtk-gui-returning-a-value-from-a-function/108299/2 "2024-01-03T12:53:03Z")

</div>

Ok, I think I’ve got it:

```julia
@async Gtk.gtk_main()
Gtk.waitforsignal(win, :destroy)
return get_gtk_property(sb_entry, :value, Float64)

```

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 3, 2024, 5:00pm UTC](https://discourse.julialang.org/t/gtk-gui-returning-a-value-from-a-function/108299/3 "2024-01-03T17:00:48Z")

</div>

Please keep posting more stuff about GUIs, this forum is seriously lacking in examples.
