[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] instance has no attribute '_Sprite__g'
you are overriding the __init__ method of your base class
(pygame.sprite.Sprite) that might cause some problems.
the correct way to do this is:
class Ship(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.sprite.__init__(self)
# and the rest of your code here
this way you redefine the __init__ method, but calling the original base
__init__ method too.
----- Original Message -----
From: "David Gudlaugsson" <Goodwyn@ameritech.net>
To: <pygame-users@seul.org>
Sent: Saturday, March 16, 2002 7:37 PM
Subject: [pygame] instance has no attribute '_Sprite__g'
> What am I doing wrong here?
>
> I've got:
>
> import pygame
> all = pygame.sprite.Group()
>
> class Ship(pygame.sprite.Sprite):
> def __init__(self):
> self.add(all)
>
> ship = Ship()
>
> I get the errors:
> in add
> has = self.__g.has_key
> AtrributeError: Ship instance has no attribute '_Sprite__g'.
>
>
> Any ideas?
> Thx
> David
>
> ____________________________________
> pygame mailing list
> pygame-users@seul.org
> http://pygame.seul.org
>
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org