get_current_sketch()

Get the py5 module’s current Sketch instance.

Examples

1
2
3
4
5
6
sketch = py5.get_current_sketch()
assert sketch.is_ready
py5.run_sketch(block=False)
assert sketch.is_running
py5.exit_sketch()
assert sketch.is_dead

Description

Get the py5 module’s current Sketch instance.

When coding py5 in module mode, a Sketch instance is created on your behalf that is referenced within the py5 module itself. That Sketch is called the “current sketch.” Use this method to access that Sketch instance directly.

Syntax

get_current_sketch() -> Sketch

Updated on September 11, 2021 16:51:34pm UTC