cocos.layer.python_interpreter module

class PythonInterpreterLayer

Bases: cocos.layer.util_layers.ColorLayer

Runs an interactive Python interpreter as a child Layer of the current Scene.

draw()

Draws itself.

on_cocos_resize(x, y)
on_enter()

Called every time just before the node enters the stage.

on_exit()

Called every time just before the node exits the stage.

on_key_press(symbol, modifiers)
on_text(symbol)
on_text_motion(motion)
cfg = {'caret.color': (255, 255, 255), 'code.color': (255, 255, 255, 255), 'code.font_name': 'Arial', 'code.font_size': 12}
doing_more = False
is_event_handler = True

enable pyglet’s events

name = 'py'
prompt = '>>> '

python prompt

prompt_more = '... '

python ‘more’ prompt