extracting null pointer address from PyCObject with ctypes
Aaron "Castironpi" Brady
castironpi at gmail.com
Sat Oct 11 14:38:14 EDT 2008
On Oct 11, 9:45 am, Gordon Allott <gordall... at gmail.com> wrote:
> Aaron "Castironpi" Brady wrote:
>
> > My pygame install just returns an integer in get_wm_info. Take a
> > look:
>
> >>>> pygame.display.get_wm_info()
> > {'window': 1180066, 'hglrc': 0}
> >>>> pygame.display.get_wm_info()['window']
> > 1180066
> >>>> ctypes.c_void_p( _ )
> > c_void_p(1180066)
>
> > You're suggesting yours looks like this:
>
> >>>> pygame.display.get_wm_info()
> > { ... 'display': ctypes.py_object( 1180066 ), ... }
>
> > What does type( display ) give you?
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> yes its different on windows and linux, windows only has a few items
> where linux has many more. 'window' is just the window 'id' at any rate
> which is not the data I am after (which is internally an address to an
> xlib structure)
> this is what pygame.display.get_wm_info() returns on linux:
> {'fswindow': 31457283, 'wmwindow': 31457284, 'window': 31457294,
> 'lock_func': <PyCObject object at 0x89dfa70>, 'unlock_func': <PyCObject
> object at 0x89dfa88>, 'display': <PyCObject object at 0x89dfa58>}
>
> note how the display object is a PyCObject, thats got the address I want
> inside it.
>
What does print pythonapi.PyCObject_AsVoidPtr(display) give you?
More information about the Python-list
mailing list