Clean shutdown


28-02-2006 11:53:54

Hey, just wondering, what are the various ways to propperly shut down a pyogre app?

I know you can have a framelistener return false, but obviously that doesn't work if you just have a loop calling Root.renderOneFrame()
(actually, just had a deeper look at root, i'm guessing Root.shutdown() does everything for me?)

Also, in that situation, there are a few problems when the ogre window loses focus (ie, it seems to stop rendering)

Finally, is there a way of catching when the user clicks the window's close X (in the corner) so I can shutdown various other things properly (working on a multi-threaded GUI)?



28-02-2006 14:19:45

It depends which GUI system you are using.
I have been making a simple equivalent to with wxPython. I should be able to post it here tomorrow or the day after tomorrow.
With wxPython, I first tried to bind the close event to root.shutdown but on the contrary, nothing happened : ogre froze during the sutdown. Right now, I am simply destroying the window the regular way and ogre correctly unregisters itself and shuts down... No need to get complicated it seems.


02-03-2006 16:23:51

Hey, well, I'm doing a simple Tkinter GUI on a seperate thread, so the pyOgre window is just using whatever windowing system it normally uses when you call Root.startRendering(). Then the seperate threads talk to each other via message Queue's.

But the most embarrasing thing at the moment is the shutdown, which is fine if you close the dos box which opens in the background (this kills both the gui and the ogre window), but if you close the gui or the ogre window first you then have to close the other two things seperately.

So I guess what I really want is for it to kill the whole app when you click on _any_ of the X's, is that possible? easy?

Got to admit I'm relatively new to Tkinter, so this might be really obvious.

ps, once I've got this done, I'll put a link to my code up for general commenting/abuse as it might be useful to anyone trying to link pyogre/pyode, or multithreading it with a gui, or just generally interested in robot football.