Py5Surface.pause_thread()#

Pause a running Sketch.

Examples#

 1def draw():
 2    py5.rect(py5.random(py5.width), py5.random(py5.height), 10, 10)
 3    py5.println(py5.frame_count)
 4
 5py5.run_sketch(block=False)
 6surface = py5.get_surface()
 7
 8# pause the sketch.
 9surface.pause_thread()
10# the sketch is no longer running and there is no output
11
12# after waiting a bit, resume the sketch
13surface.resume_thread()

Description#

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 Processing method: PSurface.pauseThread

Syntax#

pause_thread() -> None

Updated on November 12, 2021 11:30:58am UTC