I agree with Ian. You should just be able to allow the script to end
without special closure. But you may also use sys.exit() and quit().
pygame.quit() is not usually needed, unless you intend to quit pygame
and let the program continue onto something else.
What you're seeing, Bob, may be a problem with the IDE.
There is consensus that IDLE is bad. It creates weird problems (with
pygame only? not sure how far it goes). Annoyances like those with IDLE
will likely turn your students off of Python.
I don't know about WingIDE. You could try a different one. I really like
PyCharm, but it is vast in features and a memory hog--possibly not ideal
for beginners and school computers.
For learning you might consider going with a light syntax-highlighting
editor and teaching students the use of the discrete pieces that an IDE
integrates for you. In other words teach fundamentals and let an IDE be
an elective choice for later. When it comes to ferreting out problems in
the dev environment, one needs to know what is going on behind the IDE.
For me it was very useful learning nuts and bolts, and then discovering
what more an IDE can do for me.
Hope these tips are helpful.
bw
On 8/26/2015 10:55 AM, Ian Mallett wrote:
On Wed, Aug 26, 2015 at 11:38 AM, Bob Irving <bob...@gmail.com
<mailto:bob...@gmail.com>> wrote:
Is there a way to exit your game gracefully when there are errors?
We have found with both IDLE and WingIDE that the game hangs,
requiring several clicks of the X, etc.
We are ending our game loop with
pygame.quit()
sys.exit()
I prefer to let the script terminate itself (i.e. fall out the
bottom), but sys.exit should work fine too. I remember having this
issue with older versions of Python, but 2.7 or 3.* should work fine.
Here's some skeleton code
<http://geometrian.com/programming/tutorials/PyGame%20Program%20Shell.py.txt>
that I use.
Ian