[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] surfarray and numpy,numarray,numeric
- To: pygame-users@xxxxxxxx
- Subject: [pygame] surfarray and numpy,numarray,numeric
- From: "B. Bogart" <bbogart@xxxxxx>
- Date: Sat, 11 Nov 2006 18:18:55 -0800
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Sat, 11 Nov 2006 21:19:06 -0500
- In-reply-to: <20061112020944.2710B1408457@moria.seul.org>
- References: <20061112020944.2710B1408457@moria.seul.org>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Thunderbird 1.5.0.7 (X11/20060927)
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