A Stage is the main element that contains all the Sprites and dispatches events to the Sprites. It also contains a backdrop image.
| Method | __init__ |
Constructor |
| Method | add |
Undocumented |
| Method | add |
Add a background image to the stage. If this is the first one added, it will be automatically switched to. @param image Either a filename or an already converted Surface @param name (optional) A name to use for this backdrop... |
| Method | add |
Adds several backdrops at once. @param backdrops Positional arguments adding an arbitrary number of backdrops in order, of things compatible with add_backdrop() @param kwBackdrops Keyword arguments adding backdrops with the name as the key, and a value compatible with add_backdrop(). |
| Method | broadcast |
Undocumented |
| Method | destroy |
Undocumented |
| Method | forever |
Undocumented |
| Method | next |
Undocumented |
| Method | on |
If you inherit from Stage to group your scenes and sprites, override this to create and add your sprites. This is slightly easier than having to make your own __init__() and needing to call super().__init__(), although that is still valid... |
| Method | previous |
Undocumented |
| Method | random |
Undocumented |
| Method | remove |
Undocumented |
| Method | run |
Run the async function in the background until completion or until this stage is destroyed. TODO: cancel tasks on stage destroy |
| Method | sprites |
Undocumented |
| Async Method | switch |
Undocumented |
| Method | switch |
Undocumented |
| Method | when |
When a any part of the stage is clicked, call the given handler If allClicks=True, this will be called even if there are sprites at this point too. |
| Method | when |
Register an event handler to be called when the screen and all sprites are done drawing. This gives a chance to manually draw more stuff with raw pygame commands on the raw pygame Surface. The callback should look like this: def drawExtraStuff(stage, surface): pygame... |
| Method | when |
Undocumented |
| Method | when |
Undocumented |
| Property | backdrop |
Undocumented |
| Property | backdrop |
Note: starts at 0. May be -1 if there are no backdrops at all. |
| Async Method | _ask |
Draws the text box on the string and asynchronously waits until the user has entered the value. @return answer as a string |
| Method | _on |
Undocumented |
| Method | _on |
Undocumented |
| Method | _on |
Undocumented |
| Method | _on |
A click happens on mouse up |
| Method | _sprite |
Used by sprite layer methods to reorder the sprite in the stage's drawing order list. |
| Method | _start |
Undocumented |
| Method | _update |
Draw everything. TODO: draw only what changed. |
| Instance Variable | _all |
Undocumented |
| Instance Variable | _backdrop |
Undocumented |
| Instance Variable | _backdrops |
Undocumented |
| Instance Variable | _background |
Undocumented |
| Instance Variable | _dialog |
Undocumented |
| Instance Variable | _draw |
Undocumented |
| Instance Variable | _key |
Undocumented |
| Instance Variable | _name |
Undocumented |
| Instance Variable | _on |
Undocumented |
| Instance Variable | _on |
Undocumented |
| Instance Variable | _on |
Undocumented |
| Instance Variable | _sprites |
Undocumented |
Add a background image to the stage. If this is the first one added, it will be automatically switched to. @param image Either a filename or an already converted Surface @param name (optional) A name to use for this backdrop. If omitted, then a name is generated from its 0-based index.
Adds several backdrops at once. @param backdrops Positional arguments adding an arbitrary number of backdrops in order, of things compatible with add_backdrop() @param kwBackdrops Keyword arguments adding backdrops with the name as the key, and a value compatible with add_backdrop().
If you inherit from Stage to group your scenes and sprites, override this to create and add your sprites. This is slightly easier than having to make your own __init__() and needing to call super().__init__(), although that is still valid. TODO: init vs start is confusing. Make it work for both 'when_started' and subclassing, and for both sync and async...
Run the async function in the background until completion or until this stage is destroyed. TODO: cancel tasks on stage destroy
When a any part of the stage is clicked, call the given handler If allClicks=True, this will be called even if there are sprites at this point too.
Register an event handler to be called when the screen and all sprites are done drawing. This gives a chance to manually draw more stuff with raw pygame commands on the raw pygame Surface. The callback should look like this: def drawExtraStuff(stage, surface): pygame.draw.rect(...) # e.g.
Draws the text box on the string and asynchronously waits until the user has entered the value. @return answer as a string