[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Re: Display won't close gracefully



Ryan Charpentier wrote:
Call pygame.quit() before your program closes. Since IDLE runs programs within its own process any problem with the program can hang IDLE.
Even if the program works normally (doesn't generate an exception), it may not work in IDLE.
What happens when you run the program through the normal interpreter is that, when the program ends, pygame is garbage collected, which automatically calls the
quit() method and gets rid of the window.
So technically a call to the quit method is not required for programs you'll only run from the command line.
Now, when you run the code in IDLE, since the program is running in the same process as IDLE, pygame doesn't get its quit method called automatically (because it is still in the scope of the interpreter, I guess), so you have to do this manually.
I am fairly certain this is correct, but I make no guarantees.
HTH,
-Luke

On 2/19/07, *Daniel McNeese * <dgmcnees@xxxxxxxxx <mailto:dgmcnees@xxxxxxxxx>> wrote:


    Luke Paireepinart <rabidpoobear@...> writes:


> Are you running the program through IDLE, perhaps?

    Yes, actually.  Does IDLE have a problem with pygame?

    What should I be doing, exactly?