title: pygame clock.tick() vs framerate in game main loop
body: <p>Every pygame has a game loop that looks like this:</p>
  
  <pre><code>while running:
      for event in pygame.event.get():        
          if event.type == pygame.QUIT:
              running = False   
      pygame.display.flip()
      print("tick " + str(pygame.time.get_ticks()))
      clock.tick(1)
  </code></pre>
  
  <p>According to the api for<code>get_ticks()</code>:</p>
  
  <blockquote>
    <p>Returns the number of millisconds since pygame.init() was called.
    Before pygame is initialized this will always be 0.</p>
  </blockquote>
  
  <p>But <code>clock.tick()</code> :</p>
  
  <blockquote>
    <p>This method should be called once per frame. It will compute how many . milliseconds have passed since the previous call.</p>
    
    <p>If you pass the optional framerate argument the function <strong>will delay to keep the game running slower</strong> than the given ticks per second. This can be used to help limit the runtime speed of a game. By calling Clock.tick(40) once per frame, the program will never run at more than 40 frames per second.</p>
  </blockquote>
  
  <p>I'm a bit confused, does it mean that <code>clock.tick()</code> directly affects how many milliseconds have passed since the start of the game?</p>
  
  <p>So <code>clock.tick(40)</code> means I "issue" 40 frames per second and the <strong>while loop runs 40 times per second?</strong></p>
  
  <p>I don't see the relation between fps and ticks.</p>
  
  <p>UPDATE:
  I actually just tested it and <code>get_ticks()</code> still returns REAL time in mls no matter what fps you give to <code>tick() - 0.1</code> or <code>30</code> or <code>60</code>.</p>
  
  <p>So it seems <code>clock.tick()</code> just sets up how fast game should run or <strong>how often while loop should update itself, run through itself</strong>. </p>
  
  <p>However I m still a bit confused, other answers are welcome.</p>