wx: PyNoAppError



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?
.



Relevant Pages

  • Re: Loop within (InStr) Loop problem - how do I re-read file in second loop?
    ... On your first time through first time through your ODAS Sub you 'Set' ... the first parameter 'objTextFile2' which at this point is an object and not ... > to have a problem with the script not re-reading the second file. ...
    (microsoft.public.scripting.vbscript)
  • Re: free source for bbs
    ... > did it the first time, fixed that, and I know how they did it the ... > second time because my password for the admin script was something ... But we are not laughing with you. ...
    (comp.lang.perl.misc)
  • Re: [kde-linux] Starting ssh at log-in
    ... convenient as possible without losing that security. ... First, if you use password caching anyway, it is only the first time you are ... previous post that your konsole flicks on the screen and then exits. ... script to run rather than a shell. ...
    (KDE)
  • Re: Support Groups
    ... I missed this the first time I read your post. ... I understood he needed to go through a script. ... fan had failed and the script discovered it was the fan on the video card ... Go with the Small Business Group. ...
    (alt.sys.pc-clone.dell)
  • Re: The End
    ... For the first time, my life didn't erupt ... my script today, by first class post. ... the BBC's New Writing Co-coordinator tomorrow or Thursday, ... a second reading. ...
    (misc.writing)