hot_reload_draw()#

Perform a hot reload of the Sketch’s draw function.

Examples#

 1import time
 2
 3
 4def draw():
 5    py5.rect(py5.mouse_x, py5.mouse_y, 10, 10)
 6
 7
 8def draw2():
 9    py5.circle(py5.mouse_x, py5.mouse_y, 10)
10
11
12py5.run_sketch()
13
14time.sleep(10)
15py5.hot_reload_draw(draw2)

Description#

Perform a hot reload of the Sketch’s draw function. This method allows you to replace a running Sketch’s draw function with a different one.

Syntax#

hot_reload_draw(draw: Callable) -> None

Parameters#

  • draw: Callable - function to replace existing draw function

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