Py5Surface.is_stopped()#

Determine if the surface is currently running an animation.

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())
1def setup():
2    py5.fill(255, 0, 0)
3    py5.rect(50, 50, 10, 10)
4
5py5.run_sketch(block=False)
6surface = py5.get_surface()
7# this will print True
8py5.println(surface.is_stopped())
 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#

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

Syntax#

is_stopped() -> bool

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