Package pygame :: Module sprite :: Class AbstractGroup |
[show private | hide private]
[frames | no frames]

## Class AbstractGroup

    object --+
             |
            AbstractGroup

Known Subclasses:
  `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__`(self)` len(group) number of sprites in group
| `__nonzero__(self)`
| `__repr__(self)`
| ``add`(self, *sprites)` add(sprite, list, or group, ...) add sprite to group
| `add_internal(self, sprite)`
| ``clear`(self, surface, bgd)` clear(surface, bgd) erase the previous position of all sprites
| ``copy`(self)` copy() copy a group with all the same sprites
| ``draw`(self, surface)` draw(surface) draw all sprites onto the surface
| ``empty`(self)` empty() remove all sprites
| ``has`(self, *sprites)` has(sprite or group, ...) ask if group has a sprite or sprites
| `has_internal(self, sprite)`
| ``remove`(self, *sprites)` remove(sprite, list, or group, ...) remove sprite from group
| `remove_internal(self, sprite)`
| ``sprites`(self)` sprites() get a list of sprites in the group
| ``update`(self, *args)` update(*args) call update for all member sprites
Inherited from object
| ``__delattr__`(...)` x.__delattr__('name') <==> del x.name
| ``__getattribute__`(...)` x.__getattribute__('name') <==> x.name
| ``__hash__`(x)` x.__hash__() <==> hash(x)
| ``__reduce__`(...)` helper for pickle
| ``__reduce_ex__`(...)` helper for pickle
| ``__setattr__`(...)` x.__setattr__('name', value) <==> x.name = value
| ``__str__`(x)` x.__str__() <==> str(x)
Inherited from type
| ``__new__`(T, S, ...)` T.__new__(S, ...) -> a new object with type S, a subtype of T

Method Details

### __len__(self) (Length operator) len(group) number of sprites in group Returns the number of sprites contained in the group.

### 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.

Generated by Epydoc 2.0 on Fri Nov 11 14:26:37 2005 | http://epydoc.sf.net