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

Re: [pygame] PATCH: Make PyGame use new NumPy



Travis Oliphant wrote:
Lenard Lindstrom wrote:
Travis Oliphant wrote:

This patch was created as a difference with r983 in SVN. The changes are straightforward and discussed here:


http://www.scipy.org/Porting_to_NumPy

under the PyGame header.

I tested the results on my Ubuntu system and the arraydemo and sound demo programs seemed to work fine.

It would be great if this patch could be incorporated as soon as possible so that PyGame is using the currently supported Numerical package for Python.

Best regards,

-Travis Oliphant

Did you confirm that pygame.surfarray.pixels_alpha() returns a writable array?
I didn't check. Could you show me code that demonstrates the problem.
This example program:

import pygame
from pygame.locals import *

pygame.init()

a = pygame.Surface((1, 1), SWSURFACE, 24)
a.set_colorkey((255, 255, 255))
x = pygame.surfarray.array_colorkey(a)
b = pygame.Surface(a.get_rect().size, SRCALPHA, 32)

pygame.surfarray.pixels_alpha(b)[...] = x


raises the following exception:

Traceback (most recent call last):
 File "colorkey.py", line 11, in <module>
   pygame.surfarray.pixels_alpha(b)[...] = x
RuntimeError: array is not writeable


I am using pygame 1.8.0.rc1 compiled with mingw gcc 3.4.5 on win32 and linked to msvcr71.dll, Python 2.5, numpy 1.0.1.


--
Lenard Lindstrom
<len-l@xxxxxxxxx>