Hi Justine,
The error is indeed a bit strange, and I suspect it's a bug in Wx.
However, most GUI toolkits were not designed to get their app created twice.
You could run the file as a script, which would restart the kernel, and
thus provide wx with a clean sheet.
Or, if you enable WX integration in IEP, you can get rid of the creation
of the app and the entering of the mainloop, and you can rerun the code
as often as you want.
Regards,
Almar
On 28-01-15 22:23,
justin...@gmail.com wrote:
> Hi all,
>
> I'm relatively new to python and looking at a wxwidgets tutorial. Might
> I have found a bug?
>
> From a tutorial page linked on the wxpython page we have this:
>
> |
>
> importwx
>
>
> app =wx.App(False)
>
> frame =wx.Frame(None,wx.ID_ANY,"Hello World")
>
> frame.Show(True)
>
> app.MainLoop()
>
> |
>
>
> This runs fine from the terminal, but within IEP it will only run once
> without generating the following traceback:
>
> Traceback (most recent call last):
>
> File "<tmp 1>", line 4, in <module>
>
> frame = wx.Frame(None, wx.ID_ANY, "Hello World")
>
> File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_windows.py", line
> 580, in __init__
>
> _windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs))
>
> PyNoAppError: The wx.App object must be created first!
>
>
> Restarting the shell within IEP allows it to be run again, once per
> shell instance.
>
> This is Python 2.7.8 on Debian Testing. What silly thing am I doing?
>
> ~Justine
>
> --
> You received this message because you are subscribed to the Google
> Groups "Interactive Editor for Python" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
iep_+uns...@googlegroups.com
> <mailto:
iep_+uns...@googlegroups.com>.
> For more options, visit
https://groups.google.com/d/optout.