title: Why is pygame.key.get_pressed not working as expected?
body: <p>The <code>pygame.key.get_pressed()</code> function seems not to be working as expected on my Mac OSX (10.11.1) using Python 3 and Pygame.</p>
  
  <p>After importing <code>pygame</code> and the <code>time</code> module I check if the <kbd>w</kbd> key (<code>pygame.K_w</code>) is pressed by using a simple <code>if</code>-statement and Pygames <code>pygame.key.get_pressed()</code> function.</p>
  
  <p>But the test fails and <code>It didn't work</code> is printed very time:</p>
  
  <pre><code>#!/usr/bin/env python3
  import pygame, time
  pygame.init()
  
  while True:
      keypressed = pygame.key.get_pressed()
  
      time.sleep(5)
      print("5 seconds later")
  
      if keypressed[pygame.K_w]:
           print("it worked")
      else: 
           print("It didn't work")
  </code></pre>