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

Re: [pygame] Help with pygame.transform.threshold



Hi,

I think it is a bug.

If you have change_return = 1, then it compares your color (RED) to each pixel in surface2, and makes the pixels in surface1 (WHITE) which are within the threadhold (0,0,0) of (RED). However since you have inverse=True, it makes the pixels that are not within the threshold of RED WHITE.

Is that what you wanted?

Really, the function should work by passing in None... however it seems to require a Surface there when you're not using it.



On Fri, Mar 4, 2011 at 1:45 AM, Thor Julsrud <thrstein@xxxxxxxxx> wrote:
Hi!
I'm trying to use the threshold function in a roguelike to get appropriate
background and foreground colors for tiles (simulating ASCII). I've simply
used pygame.transform.threshold(surface1, surface2, WHITE, (0,0,0), RED, 1,
None, True).
However, it keeps complaining "TypeError: must be pygame.Surface, not None".
If I change the None to a Surface it works, but obviously not the way I
intended to use the function... Is this simply a bug, or am I doing something
wrong?
Thanks.