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

[pygame] convert access violation



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?