I'm busy trying to learn wxPython, and i'm trying to run the following
piece of code (its from the wxPyWiki tutorial):
import wx
ID_ABOUT = 101
ID_EXIT = 110
class MainWindow(wx.F rame):
def __init__(self,p arent,id,title) :
wx.Frame.__init __(self,parent, wx.ID_ANY,title ,size=(200,100) )
self.control = wx.TextCtrl(sel f,1,style=wx.TE _MULTILINE)
self.CreateStat usBar()
filemenu = wx.Menu()
filemenu.Append (ID_ABOUT,"&Abo ut"," Information about this
program.")
filemenu.Append Separator()
filemenu.Append (ID_EXIT,"E&xit "," Terminate the program.")
menuBar = wx.MenuBar()
menuBar.Append( filemenu,"&File ")
self.SetMenuBar (menuBar)
self.Show(True)
app = wx.PySimpleApp( )
frame = MainWindow(None , -1, "Sample editor")
app.MainLoop()
Simple enough, but every single time I try to run it IDLE gives me
this instead of the app I was hoping for:
Traceback (most recent call last):
File "C:\Documen ts and Settings\Enrico Jr\My Documents\Jr's Crap
\Python Stuff\Batch Picture Converter\main. py", line 24, in <module>
frame = MainWindow(None , -1, "Sample editor")
File "C:\Documen ts and Settings\Enrico Jr\My Documents\Jr's Crap
\Python Stuff\Batch Picture Converter\main. py", line 9, in __init__
wx.Frame.__init __(self,parent, wx.ID_ANY,title ,size=(200,100) )
File "C:\Python25\Li b\site-packages\wx-2.8-msw-unicode\wx
\_windows.py", line 501, in __init__
_windows_.Frame _swiginit(self, _windows_.new_F rame(*args,
**kwargs))
PyNoAppError: The wx.App object must be created first!
As far as I can tell, the wx.App object IS being created first. I
suspect a race condition of some sort here, but can anyone shed some
light on this?
piece of code (its from the wxPyWiki tutorial):
import wx
ID_ABOUT = 101
ID_EXIT = 110
class MainWindow(wx.F rame):
def __init__(self,p arent,id,title) :
wx.Frame.__init __(self,parent, wx.ID_ANY,title ,size=(200,100) )
self.control = wx.TextCtrl(sel f,1,style=wx.TE _MULTILINE)
self.CreateStat usBar()
filemenu = wx.Menu()
filemenu.Append (ID_ABOUT,"&Abo ut"," Information about this
program.")
filemenu.Append Separator()
filemenu.Append (ID_EXIT,"E&xit "," Terminate the program.")
menuBar = wx.MenuBar()
menuBar.Append( filemenu,"&File ")
self.SetMenuBar (menuBar)
self.Show(True)
app = wx.PySimpleApp( )
frame = MainWindow(None , -1, "Sample editor")
app.MainLoop()
Simple enough, but every single time I try to run it IDLE gives me
this instead of the app I was hoping for:
Traceback (most recent call last):
File "C:\Documen ts and Settings\Enrico Jr\My Documents\Jr's Crap
\Python Stuff\Batch Picture Converter\main. py", line 24, in <module>
frame = MainWindow(None , -1, "Sample editor")
File "C:\Documen ts and Settings\Enrico Jr\My Documents\Jr's Crap
\Python Stuff\Batch Picture Converter\main. py", line 9, in __init__
wx.Frame.__init __(self,parent, wx.ID_ANY,title ,size=(200,100) )
File "C:\Python25\Li b\site-packages\wx-2.8-msw-unicode\wx
\_windows.py", line 501, in __init__
_windows_.Frame _swiginit(self, _windows_.new_F rame(*args,
**kwargs))
PyNoAppError: The wx.App object must be created first!
As far as I can tell, the wx.App object IS being created first. I
suspect a race condition of some sort here, but can anyone shed some
light on this?
Comment