Skip to main content
Engineering LibreTexts

6.14: Same Old terminate() Function

  • Page ID
  • def terminate():
    def checkForQuit():
        for event in pygame.event.get(QUIT): # get all the QUIT events
            terminate() # terminate if any QUIT events are present
        for event in pygame.event.get(KEYUP): # get all the KEYUP events
            if event.key == K_ESCAPE:
                terminate() # terminate if the KEYUP event was for the Esc key
   # put the other KEYUP event objects back

    The terminate() and checkForQuit() functions were used and explained in the Sliding Puzzle chapter, so we will skip describing them again.

    • Was this article helpful?