Re: gtk.image



brad smith wrote:
ok, thanks:) Any ideas on that?
Happy Holidays

So you did not RTFM, eh? I suggest to look there from time to time, it really helps.

Sorry, no, I have no idea. But after roughly reading the gtk.Image class reference, I don't see any way of extracting the filename, because it apparently isn't saved in gtk.Image. That's probably because the image may also come from other sources such as memory or is copied over from a gdk drawable etc. The image isn't always tied to a particular file. You'd have to do that yourself.

I'm not a pygtk expert, but that's what I could find out from the link I gave you and my experience with gtk+.


On Dec 25, 2007 1:03 PM, Tomas Carnecky <tom dbservice com> wrote:
brad smith wrote:
thanks for the reply, I tried everything I can think of, but still get
the error.
Your problem is that get_image() does _not_ return the filename, but the
gdk pixbuf for the image - as described in the pygtk reference. So if
you want to get the filename, you have to use another function.


On Dec 25, 2007 11:33 AM, Tomas Carnecky <tom dbservice com> wrote:
brad smith wrote:
Hello everyone,

I am using gtk.Image() and filling it with set_from_file with a random
I assume you're using the python bindings..

image in a directory. I am trying to use gtk.get_image() to get the
name of the image currently being displayed but I get:
gImage = self.rImage.get_image()
ValueError: image should be a GdkImage or empty

There is a image being displayed when I try to get image name.
Thanks for your time,
RTFM, especially what get_image() returns:
http://www.pygtk.org/pygtk2reference/class-gtkimage.html#method-gtkimage--get-image






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]