<p>我建议您使用<code>key.get_pressed()</code>,例如</p>
<pre><code>while True:
DISPLAYSURF.fill(WHITE)
DISPLAYSURF.blit(text ,(x , y))
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit(0)
elif event.type == KEYDOWN or event.type == KEYUP:
if event.key == K_ESCAPE:
pygame.quit()
sys.exit(0)
if pygame.key.get_pressed()[K_LEFT]:
x -= 15
if pygame.key.get_pressed()[K_RIGHT]:
x += 14
if pygame.key.get_pressed()[K_UP]:
y -= 15
if pygame.key.get_pressed()[K_DOWN]:
y += 15
pygame.display.update()
</code></pre>
<p><strong>pygame.key.按下()</strong></p>
<blockquote>
<p>Returns a sequence of boolean values representing the state of every
key on the keyboard. Use the key constant values to index the array. A
True value means the that button is pressed.</p>
<p>Getting the list of pushed buttons with this function is not the
proper way to handle text entry from the user. You have no way to know
the order of keys pressed, and rapidly pushed keys can be completely
unnoticed between two calls to pygame.key.get_pressed(). There is also
no way to translate these pushed keys into a fully translated
character value. See the pygame.KEYDOWN events on the event queue for
this functionality.</p>
</blockquote>
<p>你也可以看看<a href="https://www.pygame.org/docs/" rel="nofollow">doc</a></p>