I have an application that needs to run Panda3D, then close it, then re-open it.
There seems to be some issues with calling ShowBase.destroy() and then re-creating it. Here’s an example showing the error:
>>> from direct.showbase.ShowBase import ShowBase
>>> p3dApp = ShowBase()
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
>>> taskMgr.step()
>>> p3dApp.destroy()
>>> p3dApp = ShowBase()
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
:task(warning): Creating implicit AsyncTaskChain default for AsyncTaskManager TaskManager
>>> taskMgr.step()
Traceback (most recent call last):
File "/usr/share/panda3d/direct/showbase/EventManager.py", line 61, in eventLoopTask
self.doEvents()
File "/usr/share/panda3d/direct/showbase/EventManager.py", line 55, in doEvents
processFunc(self.eventQueue.dequeueEvent())
File "/usr/share/panda3d/direct/showbase/EventManager.py", line 122, in processEvent
messenger.send(eventName, paramList)
File "/usr/share/panda3d/direct/showbase/Messenger.py", line 325, in send
self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
File "/usr/share/panda3d/direct/showbase/Messenger.py", line 410, in __dispatch
method (*(extraArgs + sentArgs))
File "/usr/share/panda3d/direct/showbase/ShowBase.py", line 2379, in windowEvent
if win == self.win:
AttributeError: ShowBase instance has no attribute 'win'
:task(error): Exception occurred in PythonTask eventManager
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/share/panda3d/direct/task/Task.py", line 454, in step
self.mgr.poll()
File "/usr/share/panda3d/direct/showbase/EventManager.py", line 61, in eventLoopTask
self.doEvents()
File "/usr/share/panda3d/direct/showbase/EventManager.py", line 55, in doEvents
processFunc(self.eventQueue.dequeueEvent())
File "/usr/share/panda3d/direct/showbase/EventManager.py", line 122, in processEvent
messenger.send(eventName, paramList)
File "/usr/share/panda3d/direct/showbase/Messenger.py", line 325, in send
self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
File "/usr/share/panda3d/direct/showbase/Messenger.py", line 410, in __dispatch
method (*(extraArgs + sentArgs))
File "/usr/share/panda3d/direct/showbase/ShowBase.py", line 2379, in windowEvent
if win == self.win:
AttributeError: ShowBase instance has no attribute 'win'
>>>
Anyone know how to properly shut down Panda3D and then re-open it without quitting python? Thanks.