Glade interface tutorial - NoMethodError for .show_all

Hi Everyone,

I get a NoMethodError message for the .show_all instruction whilst
following the Glade Interface tutorial

Please help, I’m stuck!

Here’s what I did:

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

  2. I use the ‘ruby-glade-create-template > 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 =, nil, PROG_NAME)

then adding the following to display the window:
window =“window”)

  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

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 file if its any help)

Many thanks,

browser.rb:58: undefined method `show_all’ for nil:NilClass

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


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

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:
…and it worked perfectly! :slight_smile:

Thank you very much for your help!