GdkPixbuf.PixbufDestroyNotify - NotImplementedError - python gtk3
Asked Answered
M

1

1

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 ?

Mycobacterium answered 23/4, 2012 at 16:28 Comment(0)
M
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.

Mouthwash answered 23/4, 2012 at 21:21 Comment(3)
Are you sure this is a bug ? and I am not doing something wrong here ? Anyway reported bug. bugzilla.gnome.org/show_bug.cgi?id=674691Mycobacterium
From the bug report it looks like the developer says it's not easily fixable, but he suggests workarounds.Mouthwash
I know it's a bug because DestroyNotify functions are needed in C for memory management. However, in PyGObject, memory management should be taken care of automatically. The DestroyNotify function should be automatically provided behind the scenes and not exposed in the Python API. It's not, and so the API is broken.Mouthwash

© 2022 - 2024 — McMap. All rights reserved.