Stop the animation thread.
1 2 3 4 5 6 7 8 9 10 11
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())
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 Java method: PSurface.stopThread
stop_thread() -> bool
Updated on September 11, 2021 16:51:34pm UTC