hot_reload_draw()

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

Examples

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


def draw():
    py5.rect(py5.mouse_x, py5.mouse_y, 10, 10)


def draw2():
    py5.circle(py5.mouse_x, py5.mouse_y, 10)


py5.run_sketch()

time.sleep(10)
py5.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