Accessing glade files in GTK

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/")

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 -->
  <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>
      <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>

you’re likely to get more help if you quote your code.

1 Like

I really feel stupid.
After fighting this for way to long I saw my mistake as soon as I posted it.

I miss-spelled button (butten1) in glade :grimacing:

@sbromberger thanks for the quoting info