Py5Surface.resume_thread()

Resume a paused Sketch.

Examples

 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()

Description

Resume a paused Sketch. The Sketch window will resume operating as it did before Py5Surface.pause_thread() was called.

The frame_count will continue incrementing after the Sketch is resumed.

Underlying Java method: PSurface.resumeThread

Syntax

resume_thread() -> None

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