wx: PyNoAppError

SuperHik junkytownMAKNI at gmail.com
Wed May 31 09:37:08 EDT 2006


Hi!

Using XP SP2, PythonWin 2.4.3, any trying to use wx 2.6.3.2
When using wx, the first time I run a script it runs fine.
Second time, it rasises an error:

[Script]**********************************
import wx
app = wx.App()
win = wx.Frame(None, title="Simple Editor")
win.Show()
app.MainLoop()

[Error]***********************************
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:\Python24\mystuff\ool.pyw", line 3, in ?
     win = wx.Frame(None, title="Simple Editor")
   File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\_windows.py", 
line 493, in __init__
     newobj = _windows_.new_Frame(*args, **kwargs)
PyNoAppError: The wx.App object must be created first!
******************************************

So this happens no matter what the script is.
And it always occurs on the first line a new widget is created.
This is not a problem with the script, because it does the same
thing on every script I copied from the internet. It must be a
wx bug, but has anyone fixed it?
I googled and only found this:

http://mail.python.org/pipermail/tutor/2005-September/041678.html
*Not helpful
http://www.dogmelon.com.au/nsforum/viewtopic.php?p=5032&sid=53d6cc27c33f96f405873e044425e64c#5032
*Says that runnig the script outside of IDLE fixes the problem.
That works for me too but if there is a way to run it from IDLE
that would be much easier.

Any experience on this?



More information about the Python-list mailing list