<p>问题是您没有处理pygame的事件队列。您应该在循环结束时简单地调用<code>pygame.event.pump()</code>,然后您的代码就可以正常工作了:</p>
<pre><code>...
while not done:
clock.tick(60)
keyState = pygame.key.get_pressed()
if keyState[pygame.K_ESCAPE]:
print('\nGame Shuting Down!')
done = True
pygame.event.pump() # process event queue
</code></pre>
<p>来自<a href="http://www.pygame.org/docs/ref/event.html#pygame.event.pump">docs</a>(强调我的):</p>
<blockquote>
<p><strong>pygame.event.pump()</strong> </p>
<p><em>internally process pygame event handlers</em> </p>
<p><code>pump() -> None</code> </p>
<p><em><strong>For each frame of your game, you will need to make some sort of call to the event queue. This ensures your program can internally interact with the rest of the operating system.</strong></em> If you are not using other event functions in your game, you should call pygame.event.pump() to allow pygame to handle internal actions.</p>
<p>This function is not necessary if your program is consistently processing events on the queue through the other pygame.event functions.</p>
<p>There are important things that must be dealt with internally in the event queue. The main window may need to be repainted or respond to the system. <strong><em>If you fail to make a call to the event queue for too long, the system may decide your program has locked up</em></strong>.</p>
</blockquote>
<p>请注意,如果只在主循环中的任何地方调用<code>pygame.event.get()</code>,则不必执行此操作;如果不调用,则可能应该调用<code>pygame.event.clear()</code>,这样事件队列就不会填满。</p>