update_pixels()#

Updates the display window with the data in the pixels[] array.

Examples#

example picture for update_pixels()
1def setup():
2    img = py5.load_image("rockies.jpg")
3    py5.image(img, 0, 0)
4    half_image = img.width * img.height//2
5    py5.load_pixels()
6    for i in range(0, half_image):
7        py5.pixels[i+half_image] = py5.pixels[i]
8
9    py5.update_pixels()

Description#

Updates the display window with the data in the pixels[] array. Use in conjunction with load_pixels(). If you’re only reading pixels from the array, there’s no need to call update_pixels() — updating is only necessary to apply changes.

Underlying Processing method: updatePixels

Syntax#

update_pixels() -> None
update_pixels(x1: int, y1: int, x2: int, y2: int, /) -> None

Parameters#

  • x1: int - x-coordinate of the upper-left corner

  • x2: int - width of the region

  • y1: int - y-coordinate of the upper-left corner

  • y2: int - height of the region

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