Home | Trees | Index | Help |
---|
Package pygame :: Module sprite :: Class AbstractGroup |
|
object
--+
|
AbstractGroup
Group
A base for containers for sprites. It does everything needed to behave as a normal group. You can easily inherit a new group class from this, or the other groups below, if you want to add more features.
Any AbstractGroup-derived sprite groups act like sequences, and support iteration, len, and so on.Method Summary | |
---|---|
__init__(self)
| |
__contains__(self,
sprite)
| |
__iter__(self)
| |
len(group) number of sprites in group | |
__nonzero__(self)
| |
__repr__(self)
| |
add(sprite, list, or group, ...) add sprite to group | |
add_internal(self,
sprite)
| |
clear(surface, bgd) erase the previous position of all sprites | |
copy() copy a group with all the same sprites | |
draw(surface) draw all sprites onto the surface | |
empty() remove all sprites | |
has(sprite or group, ...) ask if group has a sprite or sprites | |
has_internal(self,
sprite)
| |
remove(sprite, list, or group, ...) remove sprite from group | |
remove_internal(self,
sprite)
| |
sprites() get a list of sprites in the group | |
update(*args) call update for all member sprites | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
Inherited from type | |
T.__new__(S, ...) -> a new object with type S, a subtype of T |
Method Details |
---|
__len__(self)
|
add(self, *sprites)add(sprite, list, or group, ...) add sprite to group Add a sprite or sequence of sprites to a group. |
clear(self, surface, bgd)clear(surface, bgd) erase the previous position of all sprites Clears the area of all drawn sprites. the bgd argument should be Surface which is the same dimensions as the surface. The bgd can also be a function which gets called with the passed surface and the area to be cleared. |
copy(self)copy() copy a group with all the same sprites Returns a copy of the group that is the same class type, and has the same sprites in it. |
draw(self, surface)draw(surface) draw all sprites onto the surface Draws all the sprites onto the given surface. |
empty(self)empty() remove all sprites Removes all the sprites from the group. |
has(self, *sprites)has(sprite or group, ...) ask if group has a sprite or sprites Returns true if the given sprite or sprites are contained in the group. You can also use 'sprite in group' or 'subgroup in group'. |
remove(self, *sprites)remove(sprite, list, or group, ...) remove sprite from group Remove a sprite or sequence of sprites from a group. |
sprites(self)sprites() get a list of sprites in the group Returns an object that can be looped over with a 'for' loop. (For now it is always a list, but newer version of Python could return different iterators.) You can also iterate directly over the sprite group. |
update(self, *args)update(*args) call update for all member sprites calls the update method for all sprites in the group. Passes all arguments on to the Sprite update function. |
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.0 on Sat Dec 9 14:11:19 2006 | http://epydoc.sf.net |