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

Re: [pygame] no unlock: surfarray.pixels2d() and PixelArray() bug or intented?



<brian@xxxxxxxxxxxxxxxxxxx> wrote:
> Do you have an example of the code you wrote that behaves differently than you wanted?
>
> It may be by design, but you may have found a bug as well. Also, > people on the list may be able to help you with ways to do what > you want without bugs or problems.

I was able to get it working by manually unlocking. It just seemed weird design:

# (1) before needing pixels
init()
    # ...
draw()
    self.screen.blit ( image, dest_rect )

# (2) adding pixel refs; breaks blit down the line
init()
    self.pixels = pygame.PixelArray( self.screen )
draw()
    self.screen.blit ( image, dest_rect )

# (3) which does an exception, but you can fix it:
init()
    self.pixels = pygame.PixelArray( self.screen )
    self.screen.unlock()
draw()
    self.screen.blit ( image, dest_rect )

--
Jake