Thanks! "There may be a bug in Pygame triggered when the newly converted image is immediately deleted. (although that does not seem likely)"
That's exactly something like that I wanted to read: an explanation (or the beginning). I hope that if a pyGame developper reads this, maybe he/she will try to reproduce the bug. It's very easy to reproduce: under Windows XP, install the package Python26 (with numpy-1.4.1 (it's included I think)) then pygame-1.9.1. Then try to run with my simple sprite example. On 21 juil, 09:07, Peter Shinners <[email protected]> wrote: > On 07/19/2010 01:12 AM, SurferIX wrote: > > > > > Hi! > > > I'm using pygame for the first time. > > I've developped a game, everything works fine but one thing I can't > > explain. > > Using Windows, python 2.6, here's what I was doing: > > > 18 class Shape(pygame.sprite.Sprite): > > 20 def __init__(self,width,height): > > 21 pygame.sprite.Sprite.__init__(self) > > 23 self.width = width > > 24 self.height = height > > 27 self.rect = pygame.Rect(0, 0, 6*5*20, 6*5*20) > > 28 self.image = pygame.Surface( (self.rect.width, > > self.rect.height) ) > > 29 self.image.fill((255, 255, 255)) > > 30 self.image.convert() > > > the line #30 was *always* generating access violation. > > I just added modified to: > > 30 self.image = self.image.convert() > > and now everything works fine. > > > But there shouldn''t have any problem at all with this simple line: > > 30 self.image.convert() > > even though it does nothing (well i guess it does nothing). > > > I'm not the kind of people who thinks "it works let's go on". I want > > to understand why it didn't work before going further. Can someone > > please explain me why this raised an Access Violation? > > I can't explain the access error. But you'll want line 30 to look like this. > > self.image = self.image.convert() > > You may try changing the code and seeing if it still dies. There may be > a bug in Pygame triggered when the newly converted image is immediately > deleted. (although that does not seem likely)
