title: Pygame display 2D numpy array
body: <p>I've created a 2D numpy array, 20x20, that has a random value of either 0, 1, or 2. 
  What I want is for each of these values to have a corresponding colour value, and for pygame to display a grid of these corresponding colour values. A 0 becomes a white square, a 1 becomes a red square, and a 2 becomes a green square, for instance. I can't seem to find a way of doing this. My code at the moment is basically a mishmash of tutorials and none of it really works, but here you go:</p>
  
  <pre><code>import numpy
  import pygame
  
  gridarray = numpy.random.randint(3, size=(20, 20))
  print(gridarray)
  
  colour0=(120,250,90)
  colour1=(250,90,120)
  colour2=(255,255,255)
  
  (width,height)=(300,300)
  
  screen = pygame.pixelcopy.make_surface(gridarray)
  pygame.display.flip()
  screen.fill(colour2)
  
  running = True
  while running:
    for event in pygame.event.get():
      if event.type == pygame.QUIT:
        running = False
  </code></pre>