# Glade interface tutorial - NoMethodError for .show\_all

**URL:** <https://www.ruby-forum.com/t/glade-interface-tutorial-nomethoderror-for-show-all/175694>\
**Category:** Ruby-Gnome 2\
**Created:** [September 17, 2009, 10:00pm UTC](https://www.ruby-forum.com/t/glade-interface-tutorial-nomethoderror-for-show-all/175694 "2009-09-17T22:00:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![day7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@day7](https://www.ruby-forum.com/u/day7)\
**Post date:** [September 17, 2009, 10:00pm UTC](https://www.ruby-forum.com/t/glade-interface-tutorial-nomethoderror-for-show-all/175694/1 "2009-09-17T22:00:48Z")

</div>

Hi Everyone,

I get a NoMethodError message for the .show\_all instruction whilst  
following the Glade Interface tutorial  
([http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-dynui](http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-dynui)).

Please help, I’m stuck!

Here’s what I did:

1. I followed the guide (to the letter) and saved as ‘browser.glade’

2. I use the ‘ruby-glade-create-template browser.glade \> browser.rb’  
command to create the ruby file.

3. Followed the instructions to edit the browser.rb to display the  
window by capturing the BrowserGlade object into a variable:  
o = BrowserGlade.new(PROG\_PATH, nil, PROG\_NAME)

then adding the following to display the window:  
window = o.glade.get\_widget(“window”)  
window.show\_all

1. However, when I try to run the code ‘ruby browser.rb’, I get the  
following terminal message:  
browser.rb:58: undefined method `show\_all’ for nil:NilClass  
(NoMethodError)

* * *

OK, so I thought I’ve made a silly mistake - I just need to find out  
what I did wrong. However, all interfaces I design in Glade (however  
simple) end up the same. I cannot get them to display by running the  
ruby script - I always get the same NoMethodError message.

To make matters more confusing; if I copy and paste the original xml  
text (posted within the tutorial) into a new .glade file and try the  
process again - it works great???

I guess I’m doing something wrong within Glade - but I’ve no idea what?  
Any help would be appreciated.

(I’ve attached my browser.glade file if its any help)

Many thanks,  
Craig.

---

<div class="post-metadata">

**Author:** ![day7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@day7](https://www.ruby-forum.com/u/day7)\
**Post date:** [September 17, 2009, 10:49pm UTC](https://www.ruby-forum.com/t/glade-interface-tutorial-nomethoderror-for-show-all/175694/2 "2009-09-17T22:49:54Z")

</div>

> browser.rb:58: undefined method `show\_all’ for nil:NilClass

This suggests that get\_widget(“window”) returned nil. Is “window” the  
right name?

-Ian

On Thu, Sep 17, 2009 at 1:00 PM, Craig Parylo

---

<div class="post-metadata">

**Author:** ![day7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@day7](https://www.ruby-forum.com/u/day7)\
**Post date:** [September 17, 2009, 11:11pm UTC](https://www.ruby-forum.com/t/glade-interface-tutorial-nomethoderror-for-show-all/175694/3 "2009-09-17T23:11:12Z")

</div>

Ian, you’re a genius!

“window” wasn’t the right widget to get. My main window was auto-labeled  
as “window1” in the glade file.

I replaced “window” with “window1” in:  
get\_widget(“window”)  
…and it worked perfectly! 🙂

Thank you very much for your help!
