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).
Please help, I’m stuck!
Here’s what I did:
-
I followed the guide (to the letter) and saved as ‘browser.glade’
-
I use the ‘ruby-glade-create-template browser.glade > browser.rb’
command to create the ruby file. -
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
- 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.