pystage.core
- class pystage.core.assets.Costume(sprite, name, center_x=None, center_y=None, factor=1)
Bases:
object
This class handles and manages costumes and backdrops.
- class pystage.core.assets.CostumeManager(owner)
Bases:
object
- ALL_AROUND = 1
- LEFT_RIGHT = 2
- NO_ROTATION = 3
- add_costume(name, center_x=None, center_y=None, factor=1)
- get_center()
- get_costume()
- get_image()
- insert_costume(index, name, center_x=None, center_y=None, factor=1)
- next_costume()
- replace_costume(index, name, center_x=None, center_y=None, factor=1)
- rotate_and_scale()
- switch_costume(name)
- update_sprite_image()
- class pystage.core.assets.Sound(sprite, name)
Bases:
object
This class handles and manages sounds.
- class pystage.core.code_block.CodeBlock(sprite_or_stage, generator_function, name='', no_refresh=False)
Bases:
object
The CodeBlock encapsulates a generator and manages its state.
- add_yields(function)
This function does the black magic and adds yields to the code so that the screen can update. This creates a generator function.
- Parameters
function (The function to be transformed to a generator function.) –
- ask(question)
- index_ast(func_ast)
Helper function to (re-)generate for each node that is in a body or orelse field its parent, the field and its position in the field.
- Parameters
func_ast (ast.AST) – The AST to be indexed.
- last_id = -1
- start_if_not_running()
Start the code block. If the block is already started, this method does nothing.
- start_or_restart()
(Re-)start the code block. If the block is already started, the current execution will not continue.
- update(dt)
Check if it is time for the next step and execute it.
- class pystage.core.code_block.CodeManager(owner)
Bases:
object
- process_broadcast(message)
- process_click()
- process_key_pressed(key)
- register_code_block(generator_function, name='', no_refresh=False)
- class pystage.core.gui.Bubble(sprite, text: str, border: pystage.core.gui.ResizableBorder)
Bases:
pygame.sprite.Sprite
- SAY = <pystage.core.gui.ResizableBorder object>
- THINK = <pystage.core.gui.ResizableBorder object>
- say_file = '/home/docs/checkouts/readthedocs.org/user_builds/pystage/checkouts/stable/src/pystage/images/say.png'
- think_file = '/home/docs/checkouts/readthedocs.org/user_builds/pystage/checkouts/stable/src/pystage/images/think.png'
- update(force=False)
method to control sprite behavior
Sprite.update(*args, **kwargs):
The default implementation of this method does nothing; it’s just a convenient “hook” that you can override. This method is called by Group.update() with whatever arguments you give it.
There is no need to use this method if not using the convenience method by the same name in the Group class.
- class pystage.core.gui.BubbleManager(sprite)
Bases:
object
- say(text: str, border=<pystage.core.gui.ResizableBorder object>)
- class pystage.core.gui.ResizableBorder(image_file, inner_rect)
Bases:
object
- render(width, height)
- pystage.core.gui.render_lines(lines, font, color, lw, lh, lh_offset)
- pystage.core.gui.wrap_text(text, font, allowed_width)
- class pystage.core.sprite.CoreSprite(stage, costume='default')
Bases:
pystage.core._motion._Motion
,pystage.core._events._Events
,pystage.core._looks._LooksSprite
,pystage.core._sound._Sound
,pystage.core._sensing._Sensing
,pystage.core._sensing._SensingSprite
,pystage.core._control._ControlSprite
,pystage.core._operators._Operators
,pystage.core._variables._Variables
,pystage.core._pen._Pen
- pystage_setname(name)
- update(dt)
method to control sprite behavior
Sprite.update(*args, **kwargs):
The default implementation of this method does nothing; it’s just a convenient “hook” that you can override. This method is called by Group.update() with whatever arguments you give it.
There is no need to use this method if not using the convenience method by the same name in the Group class.
- class pystage.core.stage.CoreStage(name='Welcome to pyStage!', width=480, height=360)
Bases:
pystage.core._looks._LooksStage
,pystage.core._sound._Sound
,pystage.core._events._Events
,pystage.core._control._Control
,pystage.core._operators._Operators
,pystage.core._sensing._Sensing
,pystage.core._variables._Variables
- pystage_createsprite(costume='default')
- pystage_play()