Py5Surface.stop_thread()

Py5Surface.stop_thread()#

Stop the animation thread.

Examples#

def draw():
    py5.rect(py5.mouse_x, py5.mouse_y, 10, 10)

py5.run_sketch(block=False)
surface = py5.get_surface()
# this will print False
py5.println(surface.is_stopped())

surface.stop_thread()
# now it will print True
py5.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

Signatures#

stop_thread() -> bool

Updated on March 06, 2023 02:49:26am UTC