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

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



Daniel McNeese wrote:
Ryan Charpentier <ryancharpen@...> writes:

Call pygame.quit() before your program closes. Since IDLE runs programs
within its own process any problem with the program can hang IDLE.

I just tested this, and it worked.

Argh. Somebody really needs to update the pygame.org tutorials to mention this. I never would have guessed that the programming environment itself was the problem.

Thanks, guys. You just saved me quite a bit of (additional) frustration.
Well, it's a very specific case. It only happens on Windows and only when you right-click a script and hit 'Edit with IDLE.'
If you open IDLE normally (menu, command-line, etc.), and load the script, IDLE will be able to open its subprocess, thus decoupling the program from the IDE.
Notice how IDLE says ****NO SUBPROCESS**** whenever you edit a script?
If IDLE is run normally, whenever you run a program you will see =====RESTART=====
which means IDLE is closing the previous subprocess and reopening one.
So if you have a problem that causes your Pygame window to crash, you don't have to wait till Windows lets you kill it.
Just go fix the problem and run the code again, and IDLE will kill the old one for you. Assuming you're running IDLE with a subprocess.
HTH,
-Luke