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

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



Lenard Lindstrom wrote:
Travis Oliphant wrote:
Lenard Lindstrom wrote:
Travis Oliphant wrote:
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.

I fixed the patch. I'll send a new patch soon. Basically, I got rid of all ->flags assignments as they were useless anyway and simply over-wrote the correct flags.


-Travis