Hello,
I have a wxPython app that works fine when I run with python.exe, however I would like to be able to run with the embedded Python interpreter in my C++ application. When I run the app the first time, it works fine. But when I close the app and try to run it again I get this exception:
Traceback (most recent call last):
File “D:\MyApp\MyApp.py”, line 10, in
frame = MyFrame(None)
File “D:\MyApp\MyApp.py”, line 6, in init
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"MyApp" )
File “D:\App\bin\x64\Debug\lib\site-packages\wx-3.0-msw\wx_windows.py”, line 580, in init
_windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs))
wx._core.PyNoAppError: The wx.App object must be created first!
Here is the code I’m using to test this issue:
import wx
class MyFrame ( wx.Frame ):
def __init__( self, parent ):
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"MyApp" )
app = wx.App(False)
frame = MyFrame(None)
frame.Show()
app.MainLoop()
Any idea how to get around this?
Thanks,
Ian