Why is my PyGame Sprite, in a Group, not drawn - AttributeError: 'Group' object has no attribute 'blitme'
The method blitme
doesn't exist in pygame.sprite.Group
. You cannot invoke a method on a pygame.sprite.Group
object, that doesn't exist. But you don't need blitme
at all. All you have to do is to invoke pygame.sprite.Group.draw()
:
Draws the contained Sprites to the Surface argument. This uses the
Sprite.image
attribute for the source surface, andSprite.rect
for the position.
For instance:
letters.draw()
pygame.sprite.Group.draw()
and pygame.sprite.Group.update()
are methods which are provided by pygame.sprite.Group
.
The former delegates the to the update
mehtod of the contained pygame.sprite.Sprite
s - you have to implement the method. See pygame.sprite.Group.update()
:
Calls the
update()
method on all Sprites in the Group [...]
The later uses the image
and rect
attributes of the contained pygame.sprite.Sprite
s to draw the objects - you have to ensure that the pygame.sprite.Sprite
s have the required attributes. See pygame.sprite.Group.draw()
:
Draws the contained Sprites to the Surface argument. This uses the
Sprite.image
attribute for the source surface, andSprite.rect
. [...]