I use
try:
...
except:
raise #show what went wrong
finally:
pygame.display.quit()
This works for me with pygame_sdl2 in a python 3.4.0 virtualenv (using idle
with a script in the VE as per
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
Hello all,
I teach Pygame in 9th grade computer science, and this is our first year
using Python/Pygame (we previously used BlitzBasic).
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
On Wed, Aug 26, 2015 at 11:38 AM, Bob Irving 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()
When using Wing, I teach students to hit the red 'stop' button. The issue
is when the process errors, it does not quit, it pauses. Thus the windows
stays open and is unresponsive. By hitting the red square 'stop' button,
you kill the process.
Paul Vincent Craven
On Wed, Aug 26, 2015 at 1:29 PM,
I believe the issue your having is when the code throws an exception,
pygame.quit() is never called ( in idle) so the window persists.
A good way to deal with this is to wrap the execution in a try/except that
calls pygame.quit then re raises the exception.
On Aug 26, 2015, at 14:23, Paul
Some example code:
Try:
While running:
.pygame.update .etc
Pygame.quit
Except exception:
Pygame.quit()
Raise
That way even if it errors we still call pygame.quit(), which is what isn't
happening since the idle doesn't call garbage collection on some