Hi!
Basically I want a small GUI to open up where it is just possible to write a line and then save that string. Is that possible?
This is how far I am right now:
## Make small interface
win = GtkWindow("Save File",300,50)
ent = GtkEntry()
set_gtk_property!(ent,:text,"Insert Filename")
push!(win,ent)
Gtk.showall(win)
str = get_gtk_property(ent,:text,String)
Now I would like it to register my input when I press “Enter”
EDIT2:
function get_filename_gui()
win = GtkWindow("Save File",300,50)
ent = GtkEntry()
set_gtk_property!(ent,:text,"Insert Filename")
push!(win,ent)
Gtk.showall(win)
str = ""
if isinteractive()
c = Condition()
signal_connect(win, "key-press-event") do widget, event
if event.keyval == 65293 #Enter
str = get_gtk_property(ent,:text,String)
notify(c)
end
end
wait(c)
end
Gtk.destroy(win)
return str
end
The code above does the trick, “using Gtk”
Kind regards