Re: [pygame] surfarray on 64-bit machines

2009-03-01 Thread Lenard Lindstrom
It's the computer, honest. It keeps changing "user" to "user". Oh no, not again. René Dudfield wrote: hehe, double typo... 'use_arraytype' http://www.pygame.org/docs/ref/surfarray.html#pygame.surfarray.use_arraytype On Mon, Mar 2, 2009 at 1:43 PM, Lenard Lindstrom wrote: A typo. It sh

Re: [pygame] surfarray on 64-bit machines

2009-03-01 Thread Marius Gedminas
On Mon, Mar 02, 2009 at 02:06:35PM +1100, René Dudfield wrote: > hehe, double typo... > > 'use_arraytype' > > http://www.pygame.org/docs/ref/surfarray.html#pygame.surfarray.use_arraytype That works better, thanks! I've refactored PySpaceWar's fading title code into three classes now, one that u

Re: [pygame] surfarray on 64-bit machines

2009-03-01 Thread René Dudfield
hehe, double typo... 'use_arraytype' http://www.pygame.org/docs/ref/surfarray.html#pygame.surfarray.use_arraytype On Mon, Mar 2, 2009 at 1:43 PM, Lenard Lindstrom wrote: > > A typo. It should be user_arraytype. >

Re: [pygame] surfarray on 64-bit machines

2009-03-01 Thread Lenard Lindstrom
Marius Gedminas wrote: Try pygame.surfarray.user_arraytype('numpy') at the start. NumPy became the default only recently with 1.9. Unfortunately, this gives me AttributeError: 'module' object has no attribute 'user_arraytype' I've got pygame 1.8.1 here (Ubuntu's 1.8.1release-0ubunt

Re: [pygame] surfarray on 64-bit machines

2009-03-01 Thread Marius Gedminas
On Sat, Feb 28, 2009 at 10:53:56AM -0800, Lenard Lindstrom wrote: > Marius Gedminas wrote: >> On Fri, Feb 27, 2009 at 08:04:30PM -0800, Lenard Lindstrom wrote: >>> But arithmetic operations have ufunc equivalents which take an >>> optional output array. This means the astype(), along with its >>

Re: [pygame] surfarray on 64-bit machines

2009-02-28 Thread Lenard Lindstrom
Marius Gedminas wrote: On Fri, Feb 27, 2009 at 08:04:30PM -0800, Lenard Lindstrom wrote: Marius Gedminas wrote: Since I'm really clueless about Numeric/numarray/numpy, please tell me if this code has any obvious shortcomings: # initialization, done once import pygame import numpy

Re: [pygame] surfarray on 64-bit machines

2009-02-28 Thread Marius Gedminas
On Fri, Feb 27, 2009 at 08:04:30PM -0800, Lenard Lindstrom wrote: > Marius Gedminas wrote: >> Since I'm really clueless about >> Numeric/numarray/numpy, please tell me if this code has any obvious >> shortcomings: >> >> # initialization, done once >> import pygame >> import numpy >> image =

Re: [pygame] surfarray on 64-bit machines

2009-02-27 Thread Lenard Lindstrom
Marius Gedminas wrote: On Fri, Feb 27, 2009 at 11:16:28AM +1100, René Dudfield wrote: hey, is it possible to use numpy instead of Numeric? Numeric really is dying now... even we are going to stop trying to keep it working. I suppose I should. Since I'm really clueless about Numeric

Re: [pygame] surfarray on 64-bit machines

2009-02-26 Thread Marius Gedminas
On Fri, Feb 27, 2009 at 11:16:28AM +1100, René Dudfield wrote: > hey, > > is it possible to use numpy instead of Numeric? Numeric really is > dying now... even we are going to stop trying to keep it working. I suppose I should. Since I'm really clueless about Numeric/numarray/numpy, please tel

Re: [pygame] surfarray on 64-bit machines

2009-02-26 Thread René Dudfield
hey, is it possible to use numpy instead of Numeric? Numeric really is dying now... even we are going to stop trying to keep it working. cheers, On Fri, Feb 27, 2009 at 10:49 AM, Marius Gedminas wrote: > This was a long time ago (shame on me for not finding the time to > investigate this f

Re: [pygame] surfarray on 64-bit machines

2009-02-26 Thread Marius Gedminas
This was a long time ago (shame on me for not finding the time to investigate this further): > On Wed, Oct 22, 2008 at 7:23 PM, Marius Gedminas wrote: > > A user reported that PySpaceWar fails on 64-bit Linux machines if I try > > to scale the alpha channel. Here's the code (simplified): > > > >

Re: [pygame] surfarray on 64-bit machines

2008-10-22 Thread Greg Ewing
Lenard Lindstrom wrote: It is a two dimension array, so I am surprised the single index slice [:] even works. Well, a 2d array can be thought of as a 1d array of 1d arrays, so you're getting an array of all of those 1d arrays, making another 2d array. Seems to work that way in Numeric at leas

Re: [pygame] surfarray on 64-bit machines

2008-10-22 Thread Lenard Lindstrom
Hi Marius, I am curious, but what happens if array[:] is replaced with array[...]. It is a two dimension array, so I am surprised the single index slice [:] even works. The alternate form [..] is indifferent to array dimension. Lenard Marius Gedminas wrote: A user reported that PySpaceWar f

Re: [pygame] surfarray on 64-bit machines

2008-10-22 Thread Charlie Nolan
I may be having this same error. I've got a bug report with that same error message at one point (and on a 64-bit machine), even though it works fine on my (32-bit) machine. Could you try printing out "array[:].shape"? In my case, I do a sensible slice and somehow end up with a 0x600 array. -FM

[pygame] surfarray on 64-bit machines

2008-10-22 Thread Marius Gedminas
A user reported that PySpaceWar fails on 64-bit Linux machines if I try to scale the alpha channel. Here's the code (simplified): import pygame import Numeric image = pygame.image.load('title.png') # has an alpha channel mask = pygame.surfarray.array_alpha(image).astype(Numeric.