# Fail to execute jl. file

**URL:** https://discourse.julialang.org/t/fail-to-execute-jl-file/59590
**Category:** General Usage
**Created:** [April 19, 2021, 12:59pm UTC](https://discourse.julialang.org/t/fail-to-execute-jl-file/59590 "2021-04-19T12:59:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Rafael\_Brus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael_brus/32/23767_2.png) [@Rafael\_Brus](https://discourse.julialang.org/u/Rafael_Brus)
#### Post date: [April 19, 2021, 12:59pm UTC](https://discourse.julialang.org/t/fail-to-execute-jl-file/59590/1 "2021-04-19T12:59:08Z")

</div>

How can I execute this code by clicking on the jl file on windows?

```julia
using Gtk

ls = GtkListStore(String, Int, Bool)
push!(ls,("Peter",20,false))
push!(ls,("Paul",30,false))
push!(ls,("Mary",25,true))
insert!(ls, 2, ("Susanne",35,true))

tv = GtkTreeView(GtkTreeModel(ls))

rTxt = GtkCellRendererText()
rTog = GtkCellRendererToggle()

c1 = GtkTreeViewColumn("Name", rTxt, Dict([("text",0)]))
c2 = GtkTreeViewColumn("Age", rTxt, Dict([("text",1)]))
c3 = GtkTreeViewColumn("Female", rTog, Dict([("active",2)]))

push!(tv, c1, c2, c3)

for (i,c) in enumerate([c1,c2,c3])
    GAccessor.sort_column_id(c,i-1)
end

selection = GAccessor.selection(tv)

# selection = GAccessor.mode(selection,Gtk.GConstants.GtkSelectionMode.MULTIPLE)

signal_connect(selection, "changed") do widget
    if hasselection(selection)        
        currentIt = selected(selection)  
        # now you can to something with the selected item     
        if ls[currentIt,3]
            ls[currentIt,3] = false
        else
            ls[currentIt,3] = true
        end
    end
end

win = GtkWindow(tv, "List View")
showall(win)

```

---

<div class="post-metadata">

### Author: ![feanor12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feanor12/32/8212_2.png) [@feanor12](https://discourse.julialang.org/u/feanor12)
#### Post date: [April 19, 2021, 1:04pm UTC](https://discourse.julialang.org/t/fail-to-execute-jl-file/59590/2 "2021-04-19T13:04:47Z")

</div>

I am not sure if it is possible.  
What you could do is generating a batch file and run that one with double clicking.

run.bat:

```julia
julia yourfile.jl

```

---

<div class="post-metadata">

### Author: ![Rafael\_Brus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael_brus/32/23767_2.png) [@Rafael\_Brus](https://discourse.julialang.org/u/Rafael_Brus)
#### Post date: [April 19, 2021, 2:42pm UTC](https://discourse.julialang.org/t/fail-to-execute-jl-file/59590/3 "2021-04-19T14:42:22Z")

</div>

I tried, but the GUI didn’t start

---

<div class="post-metadata">

### Author: ![feanor12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feanor12/32/8212_2.png) [@feanor12](https://discourse.julialang.org/u/feanor12)
#### Post date: [April 19, 2021, 2:48pm UTC](https://discourse.julialang.org/t/fail-to-execute-jl-file/59590/4 "2021-04-19T14:48:37Z")

</div>

I don’t know Gtk that well, but it seems that showall is not blocking. So if you start it with the batch file it will immediately close again. I could retain the GUI for a few seconds if I put `sleep(10)` at the end of the file. There is a better solution using signals in this stack overflow post.

[https://stackoverflow.com/questions/52589873/gtk-jl-julia-bindings-for-gtk-gtk-window-is-not-displayed-outside-the-repl](https://stackoverflow.com/questions/52589873/gtk-jl-julia-bindings-for-gtk-gtk-window-is-not-displayed-outside-the-repl)

---

<div class="post-metadata">

### Author: ![Rafael\_Brus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael_brus/32/23767_2.png) [@Rafael\_Brus](https://discourse.julialang.org/u/Rafael_Brus)
#### Post date: [April 20, 2021, 12:11pm UTC](https://discourse.julialang.org/t/fail-to-execute-jl-file/59590/5 "2021-04-20T12:11:02Z")

</div>

I’m ashamed. The solution was in the GTK.jl documentation.

[Solution!](https://juliagraphics.github.io/Gtk.jl/latest/manual/nonreplusage/)

Thanks feanor12
