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

[pygame] surfarray and numpy,numarray,numeric



Hey all,

So I'm just looking for a good way to get pixel access to images in python.

Seems surfarray is a great option. The manual states that I can use numarray,numpy or numeric:

"Any type of array (numpy, numarray or Numeric) can be used as the input to any function regardless of the array module set."
(from http://www.pygame.org/ctypes/pygame-api/pygame.surfarray-module.html)


I have chosen numarray and I suppose will eventually change to numpy.

but it seems I am actually not allowed to pass a numarray to a surfarray function:

>>> type(image)
<class 'numarray.numarraycore.NumArray'>
>>> pygame.surfarray.blit_array(mysurface, image)
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
TypeError: argument 2 must be array, not NumArray


It looks like there is no random_array module in numeric nor numpy, just numarray.


So how can I get this to work?

Thanks.
B. Bogart