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\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7913, in __init__
self._BootstrapApp()
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7487, in _BootstrapApp
return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "C:/Python25/Sd", line 27, in OnInit
frame = MyFrame(NULL, -1, "Hello from wxPython")
NameError: global name 'NULL' is not defined
Expand|Select|Wrap|Line Numbers
- 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()