Answers for "how to tell which button you pressed in pygame"

1

pygame get if button is released

for event in pygame.event.get() :
  if event.type == pygame.KEYDOWN :
    if event.key == pygame.K_SPACE :
      print "Space bar pressed down."
Posted by: Guest on January-03-2021
1

pygame holding a button down

while running: 
    keys = key.get_pressed() 
    if keys[K_DOWN]: 
        print "DOWN" 
    for e in event.get(): 
        pass
Posted by: Guest on August-26-2020

Code answers related to "how to tell which button you pressed in pygame"

Python Answers by Framework

Browse Popular Code Answers by Language