extracting null pointer address from PyCObject with ctypes
Gordon Allott
gordallott at gmail.com
Sat Oct 11 10:45:27 EDT 2008
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.
--
Gord Allott (gordallott at gmail.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20081011/e1a8f53a/attachment-0001.sig>
More information about the Python-list
mailing list