im try to activate the tutorial code for wxPython,
it is working properly when i tell it to import * from wxPython.wx
but with an error about the package,
i've done as i was told to change the import to wx
and change all wxsomething to wx.something
but when i start it it gives me an error that say
Traceback (most recent call last):
File "C:/Python25/Sd", line 32, in <module>
app = MyApp(0)
File "C:\Python25\Li b\site-packages\wx-2.8-msw-unicode\wx\_cor e.py", line 7913, in __init__
self._Bootstrap App()
File "C:\Python25\Li b\site-packages\wx-2.8-msw-unicode\wx\_cor e.py", line 7487, in _BootstrapApp
return _core_.PyApp__B ootstrapApp(*ar gs, **kwargs)
File "C:/Python25/Sd", line 27, in OnInit
frame = MyFrame(NULL, -1, "Hello from wxPython")
NameError: global name 'NULL' is not defined
am i doing something wrong?
it is working properly when i tell it to import * from wxPython.wx
but with an error about the package,
i've done as i was told to change the import to wx
and change all wxsomething to wx.something
but when i start it it gives me an error that say
Traceback (most recent call last):
File "C:/Python25/Sd", line 32, in <module>
app = MyApp(0)
File "C:\Python25\Li b\site-packages\wx-2.8-msw-unicode\wx\_cor e.py", line 7913, in __init__
self._Bootstrap App()
File "C:\Python25\Li b\site-packages\wx-2.8-msw-unicode\wx\_cor e.py", line 7487, in _BootstrapApp
return _core_.PyApp__B ootstrapApp(*ar gs, **kwargs)
File "C:/Python25/Sd", line 27, in OnInit
frame = MyFrame(NULL, -1, "Hello from wxPython")
NameError: global name 'NULL' is not defined
Code:
import wx
ID_ABOUT = 101
ID_EXIT = 102
class MyFrame(wx.Frame):
def __init__(self, parent, ID, title):
wx.Frame.__init__(self, parent, ID, title,
wx.DefaultPosition, wx.Size(200, 150))
self.CreateStatusBar()
self.SetStatusText("This is the statusbar")
menu = wx.Menu()
menu.Append(ID_ABOUT, "&About",
"More information about this program")
menu.AppendSeparator()
menu.Append(ID_EXIT, "E&xit", "Terminate the program")
menuBar = wx.MenuBar()
menuBar.Append(menu, "&File");
self.SetMenuBar(menuBar)
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(NULL, -1, "Hello from wxPython")
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()
Comment