| 145 | |
| 146 | |
| 147 | def 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 | |
| 159 | def hasWon(board): |