问题
I am trying to use GdkPixbuf.Pixbuf.new_from_data() as shown in gtk 2.x and I am passing 7 arguments. But it gives me an error that I need to pass 9 arguments.
What I am doing now was working for gtk2.x . So I figured out the other 2 arguments that I need to pass.
http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-creating.html
http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-refcounting.html#GdkPixbufDestroyNotify
One of the arguments is of type GdkPixbuf.PixbufDestroyNotify. I don't know how to do this.
I am trying help(GdkPixbuf.PixbufDestroyNotfiy) in ipython but I am getting an error.
error: NotImplementedError.
self.img_pixbuf = GdkPixbuf.Pixbuf.new_from_data(self.img.tostring(),
GdkPixbuf.Colorspace.RGB,
False,
self.img.depth,
self.img.width,
self.img.height,
self.img.width*self.img.nChannels)
#Here my self.img is cv2.cv.iplimage object (OpenCV iplimage)
I am getting following error:
/home/jay/<ipython console> in <module>()
/usr/lib/python2.7/dist-packages/gi/module.pyc in __getattr__(self, name)
241 return registry[key]
242
--> 243 return getattr(self._introspection_module, name)
244
245 def __dir__ (self):
/usr/lib/python2.7/dist-packages/gi/module.pyc in __getattr__(self, name)
189 wrapper = info.get_value()
190 else:
--> 191 raise NotImplementedError(info)
192
193 self.__dict__[name] = wrapper
NotImplementedError: <gi.CallbackInfo object (PixbufDestroyNotify) at 0x0x8df5b6c>
What could be the problem here ?
回答1:
In PyGObject you shouldn't have to deal with DestroyNotify functions. If there is one exposed in the API, then this is a bug. You should report it to bugzilla.gnome.org.
来源:https://stackoverflow.com/questions/10284465/gdkpixbuf-pixbufdestroynotify-notimplementederror-python-gtk3