I’m trying to learn glade/GTK in Julia, I have used TK in Python and TCL but have never used glade or GTK. Here is what I’m trying to do. The glade file is at the end of this post.
Julia commands:
julia> using Gtk
julia> win_object = GtkBuilder(filename="/data/tree/julia/examples/gtkG.glade")
I would like to be able to access button1 one with a string that relates
to the glade file like I can with window1 as shown below.
I can access both using a numeric index, but in a more complex example it
would be hard to determine which index to use for a given widget.
julia> win_object["window1"]
GtkWindowLeaf(name="", parent, width-request=-1, height-request=-1, ...
julia> win_object["button1"]
ERROR: UndefRefError: access to undefined reference ...
julia> win_object[1]
GtkButtonLeaf(action-name=NULL, action-target, related-action, ...
julia> win_object[2]
GtkWindowLeaf(name="", parent, width-request=-1, , ...
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="title" translatable="yes">My First Gtk.jl Program</property>
<property name="default_width">400</property>
<property name="default_height">200</property>
<property name="icon">bug.gif</property>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">Click Me</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
</child>
</object>
</interface>