is_dead

Boolean value reflecting if the Sketch has been run and has now stopped.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import time

def setup():
    py5.background(255, 0, 0)


py5.println("the sketch is ready:", py5.is_ready)

py5.run_sketch()

py5.println("the sketch is running:", py5.is_running)

py5.exit_sketch()

# wait for exit_sketch to complete
time.sleep(1)

py5.println("the sketch is dead:", py5.is_dead)
py5.println("did the sketch exit from an error?", py5.is_dead_from_error)

Description

Boolean value reflecting if the Sketch has been run and has now stopped. This will be True after calling exit_sketch() or if the Sketch throws an error and stops. This will also be True after calling Py5Surface’s Py5Surface.stop_thread() method. Once a Sketch reaches the “dead” state, it cannot be rerun.

After an error or a call to Py5Surface.stop_thread(), the Sketch window will still be open. Call exit_sketch() to close the window.

Updated on September 11, 2021 16:51:34pm UTC