Reputation: 47
I'm new using Julia + Gtk and I'm trying to create a simple window with a button that closes the window. The following code creates the window and the button, and everything seems to work fine, but when I press the button the window does not close and the program stop responding, forcing me to kill Julia REPL. No error message appears in the REPL.
using Gtk
win = GtkWindow("Main", 100,50)
button = GtkButton("Exit")
push!(win,button)
showall(win)
signal_connect(button, :clicked) do widget
println("Exit")
Gtk.gtk_quit()
end
UPDATE:
The problem seems to be in the function gtk_quit() in /src/events.js:
function gtk_quit()
ccall((:gtk_main_quit, libgtk), Void, ())
end
If I replace Gtk.gtk_quit() with ccall((:gtk_main_quit, libgtk), Void, ()) in my code I get "ERROR: UndefVarError: libgtk not defined" in the REPL .
I would appreciate if someone can suggest what is wrong here.
Upvotes: 0
Views: 1139
Reputation: 5063
Are you not just looking for the destory
function as per the docs here?
If you replace Gtk.gtk_quit()
with destroy(win)
in the above code your window is closed when the button is clicked:
using Gtk
win = GtkWindow("Main", 100,50)
button = GtkButton("Exit")
push!(win,button)
showall(win)
signal_connect(button, :clicked) do widget
Gtk.destroy(win)
println("Exit")
end
Upvotes: 3