Py5Surface.stop_thread()#

Stop the animation thread.

Examples#

 1def draw():
 2    py5.rect(py5.mouse_x, py5.mouse_y, 10, 10)
 3
 4py5.run_sketch(block=False)
 5surface = py5.get_surface()
 6# this will print False
 7py5.println(surface.is_stopped())
 8
 9surface.stop_thread()
10# now it will print True
11py5.println(surface.is_stopped())

Description#

Stop the animation thread. The Sketch window will remain open but will be static and unresponsive. Use Py5Surface.is_stopped() to determine if a Sketch has been stopped or not.

This method is different from Py5Surface.pause_thread() in that it will irreversably stop the animation. Use Py5Surface.pause_thread() and Py5Surface.resume_thread() if you want to pause and resume a running Sketch.

Underlying Processing method: PSurface.stopThread

Syntax#

stop_thread() -> bool

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