pystage.core

class pystage.core.assets.Costume(sprite, name, center_x=None, center_y=None)

Bases: object

This class handles and manages costumes and backdrops.

class pystage.core.assets.CostumeManager(owner)

Bases: object

add_costume(name, center_x=None, center_y=None)
get_center()
get_image()
insert_costume(index, name, center_x=None, center_y=None)
replace_costume(index, name, center_x=None, center_y=None)
class pystage.core.assets.Sound(sprite, name)

Bases: object

This class handles and manages sounds.

class pystage.core.assets.SoundManager(owner)

Bases: object

add_sound(name)
get_sound(name)
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.

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_key_pressed(key)
register_code_block(generator_function, name='', no_refresh=False)
pystage.core.code_block.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.) –

pystage.core.code_block.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.

class pystage.core.gui.BubbleManager(sprite)

Bases: object

SAY = <pystage.core.gui.ResizableBorder object>
THINK = <pystage.core.gui.ResizableBorder object>
say(text: str, border=<pystage.core.gui.ResizableBorder object>)
say_file = '/home/docs/checkouts/readthedocs.org/user_builds/pystage/checkouts/doc/src/pystage/images/say.png'
think_file = '/home/docs/checkouts/readthedocs.org/user_builds/pystage/checkouts/doc/src/pystage/images/think.png'
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_sprite._LooksSprite, pystage.core._sound._Sound, pystage.core._sensing._Sensing, pystage.core._sensing._SensingSprite, pystage.core._control._Control, pystage.core._control_sprite._ControlSprite, pystage.core._operators._Operators, pystage.core._variables._Variables, pystage.core._pen._Pen

class pystage.core.stage.CoreStage(name='Welcome to pyStage!', width=480, height=360)

Bases: pystage.core._looks_stage._LooksStage, pystage.core._sound._Sound, pystage.core._events._Events, pystage.core._control._Control, pystage.core._operators._Operators, pystage.core._sensing._Sensing

pystage_createsprite(costume='default')
pystage_play()