Pixbuf not loading File -- NameError?


64bit Ubuntu 10.04

I’m running this code:

x = Gtk::Pixbuf.new “folder_brown.png”

And it says:

uninitialized constant Gtk::Pixbuf (NameError)

I try to catch this error like this:

x = Gtk::Pixbuf.new “folder_brown.png”
rescue NameError => err
puts err.name
puts $!

And it says this:

uninitialized constant Gtk::Pixbuf

So the NameError is in reference to the Name “Pixbuf” not my file?

Aparently, there is an “uninitialized constant” in gtk’s class? Named
Pixbuf? The strange thing is that in Ruby-Gnome’s site they mention
that Nautilus
(file browser that I use) uses the same gtk widgets, so the Pixbuf class
must work because my file browser shows all of its icons.

What gives?



2010/10/19 Eric C. [email protected]:


And it says this:

uninitialized constant Gtk::Pixbuf

What gives?

I think you should use Gdk::Pixbuf instead of Gtk::Pixbuf

Refer to http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gdk%3A%3APixbuf

Park H.

Thank you Park!!! I never would have noticed that. They look so
similar, and it was even finding the name, ‘pixbuf’ I thought I was
going crazy.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs