title: Make a stoplight which changes colors every 2 seconds in Pygame
body: <p>My goal is to create:</p>
  <ol>
  <li>A white screen, with a green light in the middle</li>
  <li>In the redlight, contain a small light that can change color from white to red every 2 seconds</li>
  <li>On the top left side, there's a button with text 'stop light', when user click the button, spotlight changing will stop.</li>
  </ol>
  <p>My code:</p>
  <pre class="lang-py prettyprint-override"><code>import pygame
  pygame.init()
  
  # def color
  white = (255, 255, 255)
  green  = (0, 255, 0)
  red = (0, 0, 0)
  
  # screen
  screen_w = 640
  screen_h = 480
  screenSize = (screen_w, screen_h)
  screen = pygame.display.set_mode((300, 400))
  pygame.display.set_caption(&quot;white light and red light&quot;)
  
  # create button
  clock = pygame.time.Clock()
  image = pygame.image.load('pngtree-vector-play-icon-png-image_924817.jpg')
  screen.blit(image, (80, 440)) #how to add text next to the imgage?
  
  # draw circles
  pygame.draw.circle(screen, red, (320, 240), 240)
  pygame.draw.circle(screen, white, (320, 240), 120)
  pygame.draw.circle(screen, green, (320, 240), 120)
  
  
  # 2 second color change rule
  running = True
  while running:
  
      clock.tick(2)
      
  pygame.display.flip()
  pygame.quit()
  </code></pre>
  <p>I'm very new to programming so please bare with me with silly mistakes.</p>