title: python pygame error: video system not initialized
body: <p>This is the error I got I'm not sure how to fix this or what is happening to cause this. The problem seems to be under this comment. As you can see, the for loop that is using event.get apparently causes the video system to stop initializing.</p>
  
  <pre><code>Traceback (most recent call last):
    File "E:\ICS\Assignment\Super Break\Super Break.py", line 49, in &lt;module&gt;
      main()
    File "E:\ICS\Assignment\Super Break\Super Break.py", line 26, in main
      for event in pygame.event.get():
  error: video system not initialized
  
  import pygame, pySprites
  pygame.init()
  pygame.mixer.init()
  screen = pygame.display.set_mode((640, 480))
  
  def main(): 
      pygame.display.set_caption("Super Break")
  
      background = pygame.Surface(screen.get_size()) 
      background = background.convert() 
      background.fill((255, 255, 255)) 
      screen.blit(background, (0, 0))
  
      score_keeper = pySprites.ScoreKeeper() 
      ball = pySprites.Ball(screen) 
      player1 = pySprites.Player(screen, 1)
      allSprites = pygame.sprite.Group(score_keeper,ball, player1)
  
      clock = pygame.time.Clock() 
      keepGoing = True
  
      pygame.mouse.set_visible(False)
  
      while keepGoing:
          clock.tick(30)
          for event in pygame.event.get():
              if event.type == pygame.QUIT: 
                  keepGoing = False
              elif event.type == pygame.JOYHATMOTION: 
                  player1.change_direction(event.value) 
              elif event.type == pygame.KEYDOWN: 
                  if event.key == pygame.K_UP: 
                      player2.change_direction((0, 1)) 
                  if event.key == pygame.K_DOWN: 
                      player2.change_direction((0, -1))
  
  
              allSprites.clear(screen, background) 
              allSprites.update() 
              allSprites.draw(screen)        
              pygame.display.flip()            
  
              # def speed_up(self): 
              #    if self.__dx &gt; 0: 
              #       self.__dx += 1
  
          pygame.mouse.set_visible(True)
          pygame.quit()
  main()
  </code></pre>