# Ensuring Gtk.jl responsivity

**URL:** <https://discourse.julialang.org/t/ensuring-gtk-jl-responsivity/40710>\
**Category:** General Usage\
**Tags:** gtk\
**Created:** [June 4, 2020, 7:13am UTC](https://discourse.julialang.org/t/ensuring-gtk-jl-responsivity/40710 "2020-06-04T07:13:42Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Post date:** [June 5, 2020, 12:23pm UTC](https://discourse.julialang.org/t/ensuring-gtk-jl-responsivity/40710/3 "2020-06-05T12:23:44Z")

</div>

Hey @xor0110,  
this has been a long term issue, but with Julia 1.3 and its threading capabilities it actually works. Have a look at this example.

> [@Threading 1.3: Success Story](https://discourse.julialang.org/t/threading-1-3-success-story/27111/2):
>
> To answer the question myself, the following runs the UI updating code on the main thread again: using Gtk.ShortNames b = Box(:v) win = Window(b,"test") button = Button("do work") push!(b,button) pb = ProgressBar() push!(b,pb) Gtk.showall(win) function doWork() N = 20 for k=1:N Gtk.GLib.g\_idle\_add(nothing) do user\_data set\_gtk\_property!(pb,:fraction,(k-1)/(N-1) ) Cint(false) end sum(collect(1:100000000)) # some heavy work end end signal\_connect(button, "clic…

The point is to spawn the thread and put all UI code into an idle\_add.

One missing piece in that code is to spawn the thread at a different thread than the master thread. There is some package exactly for that purpose, but I have not tried it yet (you need to search in the forum, I do not remember the name).

---

_[View the full topic](https://discourse.julialang.org/t/ensuring-gtk-jl-responsivity/40710)._
