title: multiple clicks registering in pygame
body: <p>I'm trying to make a board that changes color upon a left mouse click.  But when I click it cycles through is_square_clicked() 3 times.  That's a problem, I only want it to do it once.  As you can probably guess this causes an issue for my program.  So how do I limit it to 1 pass through per click?  Thanks!</p>
  
  <pre><code>def is_square_clicked(mousepos):
      x, y = mousepos
      for i in xrange(ROWS):
          for j in xrange(COLS):
              for k in xrange(3):
                  if x &gt;= grid[i][j][1] and x &lt;= grid[i][j][1] + BLOCK:
                      if y &gt;= grid[i][j][2] and y &lt;= grid[i][j][2] + BLOCK: 
                          if grid[i][j][0] == 0:
                              grid[i][j][0] = 1
                          elif grid[i][j][0] == 1:
                              grid[i][j][0] = 0
  
  while __name__ == '__main__':
      tickFPS = Clock.tick(fps)
      pygame.display.set_caption("Press Esc to quit. FPS: %.2f" % (Clock.get_fps()))
      draw_grid()
      for event in pygame.event.get():
          if event.type == pygame.QUIT:
              pygame.quit()
              sys.exit()
          elif event.type == pygame.KEYDOWN:
              if event.key == pygame.K_ESCAPE:
                  pygame.quit()
                  sys.exit()
          elif event.type == pygame.MOUSEBUTTONUP and event.button == 1:
              mousepos = pygame.mouse.get_pos()
              is_square_clicked(mousepos)
      pygame.display.update()
  </code></pre>