Pixbuf not loading File -- NameError?

E

Eric C.

Hi:

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:

begin
x = Gtk::pixbuf.new "folder_brown.png"
rescue NameError => err
puts err.name
puts $!
end

And it says this:

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

Thanks!
 
H

Heesob Park

Hi,

2010/10/19 Eric C. said:
Hi:

64bit =C2=A0Ubuntu 10.04


I'm running this code:

=C2=A0x =3D Gtk::pixbuf.new "folder_brown.png"

And it says:

uninitialized constant Gtk::pixbuf (NameError)


I try to catch this error like this:

begin
=C2=A0x =3D Gtk::pixbuf.new "folder_brown.png"
rescue NameError =3D> err
=C2=A0puts err.name
=C2=A0puts $!
end

And it says this:

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

Regards,
Park Heesob
 
E

Eric C.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top