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

Re: [pygame] Exiting a program abnormally



I was thinking more of times when the main game loop itself gets
muddled up (I'm writiing a gui and thus the main loop for events can
get pretty complex). Allegro does this, although I never really got on
with the lib itself.


On Wed, 23 Feb 2005 20:12:27 -0500, Kris Schnee <kschnee@xxxxxxxxxx> wrote:
> Chris Smith wrote:
> > Is there an easy way to abnormally exit from a program using pygame?
> > Running my code in full-screen, I've had to kill X and then log back
> > in again - very annoying.
> > I normally use windowed mode but you have to test in all situations.
> > Was caught out tonight because I commented out the exit code in my gui
> > :-(
> >
> 
> Part of the solution is:
> pygame.display.quit()
> 
> You can link that to some event like a keypress in your main input loop.
> I'm not sure how to actually end the program, but if you're desperate
> you can do a deliberate crash like:
> print "The Spanish Inquisition" + 42
> 
> Kris
> 
> 


-- 
Science is open source religion