title: Using MOUSEBUTTONDOWN in pygame
body: <p>So I am trying to do some very basic things in pygame.  It is my first few days using it so I am a beginner.  I am trying to change the color of something whenever I press it with the mouse.  I know how to change the colors by timing which is what I have my code down below.  I am trying to change the color of the cloud in my code below, if you run it you will see the cloud is the top left and I have it changing between white and black every three seconds but I want it to change based on mousebuttondown.  Thanks</p>
  
  <pre><code>import pygame, time, sys
  from pygame.locals import *
  
  def drawItem(windowSurface, x, y):
      pygame.draw.polygon(windowSurface, RED, ((0+x, 100+y),(100+x, 100+y), (50+x, 50+y)))
      pygame.draw.polygon(windowSurface, GREEN, ((0+x,100+y),(100+x,100+y),(100+x,200+y),(0+x,200+y)))
  
  
  pygame.init()
  
  windowSurface = pygame.display.set_mode((500, 400), 0, 32)
  pygame.display.set_caption("Lab 9")
  
  BLACK = (0, 0, 0)
  WHITE = (255, 255, 255)
  RED = (255, 0, 0)
  GREEN = (0, 255, 0)
  GRASS = (26, 82, 26)
  SKY = (179,237,255)
  
  color = SKY
  flag = False
  
  while True:
      for event in pygame.event.get():
          if event.type == QUIT:
              pygame.quit()
          sys.exit()
  
      windowSurface.fill(SKY)
  
      drawItem(windowSurface,200,120)
      pygame.draw.rect(windowSurface, GRASS, (0,300,500,500),0)
  
      house = ((0+50, 100+50),(100+50, 100+50), (50+50, 50+50), (50+100, 50+100))
  
      for i in range(3):
          pygame.draw.circle(windowSurface,color, house[i], 80)  
  
      if flag == False:
          color = WHITE
          flag = True
      elif flag == True:
          color = BLACK
          flag = False
  
      pygame.display.update()
      time.sleep(3)
  </code></pre>