clear()#

Clear the drawing surface by setting every pixel to black.

Examples#

example picture for clear()
1def setup():
2    py5.fill(255)
3    py5.rect(5, 5, 40, 40)
4    py5.clear()
5    py5.rect(55, 55, 40, 40)

Description#

Clear the drawing surface by setting every pixel to black. Calling this method is the same as passing 0 to the background() method, as in background(0).

This method behaves differently than Py5Graphics.clear() because Py5Graphics objects allow transparent pixels.

Underlying Processing method: clear

Syntax#

clear() -> None

Updated on May 02, 2022 12:07:22pm UTC