Re: Create GLib.OptionContext from pointer



On Sun, Apr 15, 2018 at 3:31 AM, Aleksandr Mezin
<mezin alexander gmail com> wrote:
I call a non-introspectable function through ctypes. The function
returns GOptionContext*.
How can I create a pygobject wrapper (GLib.OptionContext) for it?

You can't really, please open an issue at
https://gitlab.gnome.org/GNOME/pygobject/issues and describe your use
case.

I found this answer on SO, but it's for GObject-derived types only:
https://stackoverflow.com/questions/8668333/create-python-object-from-memory-address-using-gi-repository
Also, it seems to use private interfaces (are they supposed to be kept
compatible?).

This is the public C interface, which also can be accessed through
ctypes. It will stay compatible but as you can see it's not that easy
to use from within Python.

I can't find anything for GOptionContext*, even using private
interface. Most probably, pyg_option_context_new is what I need, but
it isn't mentioned in any installed header files, and also seems to
not be called/used anywhere at all (full-text search over pygobject
sources).


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