GNOME Bugzilla – Bug 674691
gdk_pixbuf_new_from_data() is not introspectable due to PixbufDestroyNotify argument
Last modified: 2014-07-19 03:14:45 UTC
Created attachment 212661 [details] PixbufDestroyNotify I am unable to access GdkPixbuf.PixbufDestroyNotfiy. I am getting an error. Error: NotImplementedError. I am getting the same error even when try >>> help(GdkPixbuf.PixbufDestroyNotify) in ipython. I have described the error that I encountered and attached it in the file.. I think the bindings are incomplete. Please look into it.
You are not supposed to provide destroy notify methods when using GI bindings, these need to be provided by pygobject/gjs/etc. themselves. pygobject automatically provides GDestroyNotify arguments, but as PixbufDestroyNotify is a custom thing from gdk-pixbuf, this cannot be handled. One possible way to make this introspectable would be for gdk-pixbuf to make PixbufDestroyNotify an alias for GDestroyNotify (to maintain API compatibility), and actually use GDestroyNotify. This would be an ABI break, though. So right now I'm afraid that new_from_data() is not introspectable due to this. Fortunately it is the only method that needs a PixbufDestroyNotify, so you can still use new_from_file(), or just new() and set the data later.
I have been looking into how to make GdkPixbuf play nicely with numpy again (as pygtk used to). I am going to be at GUADEC to discuss this (and other perspectives on using PyGObject+Gtk in a scientific context) Any ideas for how to proceed with this?
> or just new() and set the data later This probably isn't the best place to ask, but how would you do this? The only thing I can see is Pixbuf.get_pixels(), which gives me an immutable bytes object.
This has recently been improved by introducing ways to create pixbufs from GBytes and extract the data in that form, so at least the memory management problem of destroy notifies should be lessened.