Exiting IDLE properly :)

Hi, some people seem to have had trouble getting the python IDLE GUI to exit games after testing them, this is because of the way idle behaves, sometimes the same code can be exited if ran in a terminal.

There is a solution in the pygame FAQ similer to the way I implemented ours that makes both executions act the same.


it uses loops and pygame.quit() to exit at the right time.


# ... running = True
while running:
    event = pygame.event.wait ()
    if event.type == pygame.QUIT:
        running = False  # Be IDLE friendly
pygame.quit ()