Skip to content
← Back to Community
Can't iterate over return value of pygame.surfarray.array3d() with np.nditer()
Profile icon
Dunce

when I run the following code:

import numpy as np import pygame surface = pygame.Surface((300, 300)) array = pygame.surfarray.array3d(surface) for indexs, color in np.nditer(array, ["multi_index"]): print(color)

I get the this error message: TypeError: iteration over a 0-d array

Voters
Profile icon
Dunce