MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / checkForKeyPress

Function checkForKeyPress

src/gamesbyexample/pygame_games/wormy.py:117–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115
116
117def checkForKeyPress():
118 if len(pygame.event.get(QUIT)) > 0:
119 terminate()
120
121 keyUpEvents = pygame.event.get(KEYUP)
122 if len(keyUpEvents) == 0:
123 return None
124 if keyUpEvents[0].key == K_ESCAPE:
125 terminate()
126 return keyUpEvents[0].key
127
128
129def showStartScreen():

Callers 2

showStartScreenFunction · 0.70
showGameOverScreenFunction · 0.70

Calls 1

terminateFunction · 0.70

Tested by

no test coverage detected