Py5Surface.is_stopped()#
Determine if the surface is currently running an animation.
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())
def setup():
py5.fill(255, 0, 0)
py5.rect(50, 50, 10, 10)
py5.run_sketch(block=False)
surface = py5.get_surface()
# this will print True
py5.println(surface.is_stopped())
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#
Determine if the surface is currently running an animation. A Sketch that has called no_loop() or has no draw()
function is not animating, and will result in this method returning True
. If there is a draw()
function and no_loop() has not been called, this will return False
. Calling Py5Surface’s Py5Surface.stop_thread() will make all future calls to is_stopped()
return True
.
The output of this method is independent of Py5Surface.pause_thread() and Py5Surface.resume_thread().
Underlying Processing method: PSurface.isStopped
Signatures#
is_stopped() -> bool
Updated on March 06, 2023 02:49:26am UTC