当我单击 Help->Help... 或 File->Exit 时,我从MessageBox得到相同的响应。我不明白,我哪里错了。(我对 wxPython 很陌生)
我有这个来自wxPython的代码片段:
class NewSheet(wx.Frame):
'''Anatomy of Sheet Frame'''
def __init__(self, parent, id, title,Nrows,Ncols,SheetName):
wx.Frame.__init__(self, parent, -1, title, size = (550, 500))
box = wx.BoxSizer(wx.VERTICAL)
menuBar = wx.MenuBar()
menu1 = wx.Menu()
menuBar.Append(menu1, '&File')
menu1.Append(1,"&Exit")
self.Bind(wx.EVT_MENU, self.OnExit,id = 2)
menuBar.Append(menu8, '&Help')
menu8.Append(1, "&Help...")
self.Bind(wx.EVT_MENU, self.OnHelp, id=1)
self.SetMenuBar(menuBar)
self.SetSizer(box)
notebook = wx.Notebook(self, -1, style=wx.RIGHT)
sheet1 = MySheet(notebook,Nrows,Ncols)
notebook.AddPage(sheet1, str(SheetName))
sheet1.SetFocus()
box.Add(notebook, 1, wx.EXPAND)
self.Centre()
self.Show(True)
def OnExit(self,event):
self.Close(True) #NOT WORKING!
self.Exit() #NOT WORKING EITHER!
def OnHelp(self,event):
wx.MessageBox("HTML Based Help System coming soon","Help System",wx.OK | wx.ICON_INFORMATION, self)
当我单击 Help->Help... 或 File->Exit 时,我从 MessageBox 得到相同的响应。我不明白,我哪里错了。你能给些建议么?