In my code, I run the entire panda3d loop within a try except statement. This means that, in the panda3d window, if I call self.finalizeExit()
it raises a systemExit exception which I can catch back in that try except statement. What this does is, in the ‘except’ statement, I re-create a menu, effectively allowing me to close Panda3d and automatically go back to the original menu I launched the 3d window from. Now this normally works when I have clicked on the 3d window and press the key binded to my exit function, however this causes glitches with mouse movement. So, I’ve put a button in a frame using wx.python, and binded the button to the same exit function. However, when I click this button, instead of raising a SystemExit error that I can catch, it just fully exits the application. I wonder if its to do with the fact I’m clicking a button in a different tab to the panda3d window? How do I get it to properly work? Any help appreciated ty
My code:
Code within original menu that runs panda3d object (OrbitalWindow)
try:
self.Sim = OrbitalWindow()
self.Sim.run()
except SystemExit as e:
self.windowInit()
self.initImage()
self.titleCard.SetLabel("")
My finalise exit function within my panda3d class OrbitalWindow:
def exitApp(self, event=None):
self.props.set_mouse_mode(0)
self.mFrame.Destroy()
self.destroy()
self.finalizeExit()
raise SystemExit