RE: [PyOpenGL-Users] Have exceptions terminate glutMainLoop
Brought to you by:
mcfletch
From: Tarn W. B. <twb...@ma...> - 2001-10-05 23:32:32
|
| Would it be possible to have exceptions raised during | glutMainLoop processing | (ie. in the callbacks) actually terminate the loop? I find that | if there is a | problem, the exception ends up scrolling way off the screen when | the matrix | stack gets confused. I then have to quickly terminate my program | before the | initial exception disappears - which happens often when I'm working in | fullscreen mode. glutMainLoop never returns so it's not possible to pass an exception through the loop. Right now all exceptions are caught before reentering the loop. I did this mostly to make sys.exit work as this was broken in PyGLUT. Although after a bit more thought I think the right way to do this is to exit the script completely on an exception. But for right now if you want to halt the loop this is what you will have to do: ---------------- import traceback def on_display(): try: # draw except: traceback.print_exc() sys.exit(1) glutDisplayFunc(on_display) glutMainLoop() print "This print never gets executed" ---------------- Tarn |