[PySDL][ctypes] Unable to call SDL_QueryTexture

In order to get the size of a texture I want to use SDL_QueryTexture. it expects LP_c_long types for width and height, so here is what i did:

Code:
w = ctypes.c_ulong()
h = ctypes.c_ulong()
sdl2.SDL_QueryTexture(sdlTexture, None, None, ctypes.byref(w), ctypes.byref(h))

ctypes.ArgumentError: argument 4: <class ‘TypeError’>: expected LP_c_long instance instead of pointer to c_ulong

Code:
w = ctypes.POINTER(ctypes.c_ulong)
h = ctypes.POINTER(ctypes.c_ulong)
sdl2.SDL_QueryTexture(sdlTexture, None, None, w, h)

ctypes.ArgumentError: argument 4: <class ‘TypeError’>: expected LP_c_long instance instead of _ctypes.PyCPointerType

At this point I am a bit lost cause my knowledge of ctypes is very basic and the documentation doesnt help me figure out what i am supposed to do here instead.

On, Mon Aug 26, 2013, theASDF wrote:

In order to get the size of a texture I want to use
SDL_QueryTexture. it expects LP_c_long types for width and height, so
here is what i did:

Code:
w = ctypes.c_ulong()
h = ctypes.c_ulong()
sdl2.SDL_QueryTexture(sdlTexture, None, None, ctypes.byref(w), ctypes.byref(h))

ctypes.ArgumentError: argument 4: <class ‘TypeError’>: expected
LP_c_long instance instead of pointer to c_ulong

And the error clearly states that you are using the wrong types (c_ulong
instead of c_long or c_int).

Take a look at sdl2/test/render_test.py or the constructor code of
sdl2.ext.TextureSprite, which use SDL_QueryTexture for an example on how
to use the function.

Cheers
Marcus
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130826/73599452/attachment.pgp