Pause a running Sketch.
1 2 3 4 5 6 7 8 9 10 11 12 13
def draw(): py5.rect(py5.random(py5.width), py5.random(py5.height), 10, 10) py5.println(py5.frame_count) py5.run_sketch(block=False) surface = py5.get_surface() # pause the sketch. surface.pause_thread() # the sketch is no longer running and there is no output # after waiting a bit, resume the sketch surface.resume_thread()
Pause a running Sketch. The Sketch window will be static and unresponsive. You can resume the Sketch with Py5Surface.resume_thread().
The frame_count will not increment while the Sketch is paused.
Pausing a Sketch is not the same as stopping a Sketch, so this method will not change the results of Py5Surface.is_stopped().
Underlying Java method: PSurface.pauseThread
pause_thread() -> None
Updated on September 11, 2021 16:51:34pm UTC