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

Function checkForQuit

src/gamesbyexample/pygame_games/inkspill.py:147–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

145
146
147def checkForQuit():
148 # Terminates the program if there are any QUIT or escape key events.
149 for event in pygame.event.get(QUIT): # get all the QUIT events
150 pygame.display.quit(); pygame.quit() # Display quit is a workaround for a Raspberry Pi bug. # terminate if any QUIT events are present
151 sys.exit()
152 for event in pygame.event.get(KEYUP): # get all the KEYUP events
153 if event.key == K_ESCAPE:
154 pygame.display.quit(); pygame.quit() # Display quit is a workaround for a Raspberry Pi bug. # terminate if the KEYUP event was for the Esc key
155 sys.exit()
156 pygame.event.post(event) # put the other KEYUP event objects back
157
158
159def hasWon(board):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected