update_np_pixels()

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

Examples

example picture for update_np_pixels()
1
2
3
4
5
6
def setup():
    img = py5.load_image("rockies.jpg")
    py5.image(img, 0, 0)
    py5.load_np_pixels()
    py5.np_pixels[50:100, :, :] = py5.np_pixels[:50, :, :]
    py5.update_np_pixels()

Description

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

The update_np_pixels() method is similar to update_pixels() in that update_np_pixels() must be called after modifying np_pixels[] just as update_pixels() must be called after modifying pixels[].

Syntax

update_np_pixels() -> None

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