# Accessing glade files in GTK

**URL:** https://discourse.julialang.org/t/accessing-glade-files-in-gtk/18227
**Category:** General Usage
**Created:** [December 2, 2018, 8:58pm UTC](https://discourse.julialang.org/t/accessing-glade-files-in-gtk/18227 "2018-12-02T20:58:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lkadgrjh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lkadgrjh/32/6231_2.png) [@lkadgrjh](https://discourse.julialang.org/u/lkadgrjh)
#### Post date: [December 2, 2018, 8:58pm UTC](https://discourse.julialang.org/t/accessing-glade-files-in-gtk/18227/1 "2018-12-02T20:58:49Z")

</div>

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

```

---

<div class="post-metadata">

### Author: ![anon94023334](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon94023334](https://discourse.julialang.org/u/anon94023334)
#### Post date: [December 2, 2018, 9:02pm UTC](https://discourse.julialang.org/t/accessing-glade-files-in-gtk/18227/2 "2018-12-02T21:02:07Z")

</div>

you’re likely to get more help if you [quote your code](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530).

---

<div class="post-metadata">

### Author: ![lkadgrjh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lkadgrjh/32/6231_2.png) [@lkadgrjh](https://discourse.julialang.org/u/lkadgrjh)
#### Post date: [December 2, 2018, 9:14pm UTC](https://discourse.julialang.org/t/accessing-glade-files-in-gtk/18227/3 "2018-12-02T21:14:24Z")

</div>

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 😬

@sbromberger thanks for the quoting info
