I have been going through the first examples in 'Getting Started A First
Application: "Hello, World"" at wiki.wxpython.org.
When I save the script from Notepad and run it it all works fine and as
expected. If I import the script into PythonWin IDE and run it, all works fine
as per the samples. But if I run the script a second time from within PythonWin
I get the following error messages:
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\Documents and Settings\Administrator\My
Documents\projectspython\examplewx\second.py", line 20, in ?
frame = MainWindow(None, -1, "Sample editor")
File "C:\Documents and Settings\Administrator\My
Documents\projectspython\examplewx\second.py", line 6, in __init__
wx.Frame.__init__(self,parent,wx.ID_ANY, title, size = (200,100))
File "C:\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\_windows.py", line
484, in __init__
newobj = _windows_.new_Frame(*args, **kwargs)
PyNoAppError: The wx.App object must be created first!
where second.py contains the script for "Adding a Menu". I get the same error
regardless of which of the sample scripts I run.
I am sure I must have overlooked something silly but would appreciate any
pointers to what I need to do to allow my scripts to run more than once.
Regards,
Roy
···
----------------------------------------------------------------
This message was sent using MyMail