defines an exit function.
def exit(): for e in pygame.event.get(): if e.tpye==pygame.QUIT: pygame.quit(); sys.exit() exit()