On, Sun Jun 08, 2008, Greg Ewing wrote: > Brian Fisher wrote: > > so the idea is to do something more like this: > > self.pixels = pygame.PixelArray( self.screen ) # locks screen > > draw() > > del self.pixels # automatically unlocks screen > > I don't think it's a good idea to rely entirely on reference > counting for releasing the lock, as it's easy to inadvertently > have extra references to an object around that are hard to > track down. > > The pixel array should have some kind of explicit close() > method that you can call to make sure the lock is released > (and subsequent operations on it should raise an exception). I think, the reference counting is somewhat better than a close operation which causes references you explicitly keep somewhere to misbehave. Regards Marcus
Attachment:
pgpihTxlDJovE.pgp
Description: PGP signature