wxGlade : 生成的EVT_CLOSE关闭事件代码,运行崩溃
我用wxGlade生成Python的UI代码,但添加监听EVT_CLOSE事件代码时,运行崩溃 Traceback (most recent call last): File "/Users/zxs.zl/Desktop/Yan/github/XcodeBuildPyUI/zlBuild/app.py", line 16, in OnInit self.frame = mainFrame(None, wx.ID_ANY, "") File "/Users/zxs.zl/Desktop/Yan/github/XcodeBuildPyUI/zlBuild/mainFrame.py", line 38, in __init__ self.Bind(wx.EVT_CLOSE, self.onWindowClose, self.frame) AttributeError: 'mainFrame' object has no attribute 'frame' 生成的代码部分: class mainFrame(wx.Frame): def __init__(self, *args, **kwds): # begin wxGlade: mainFrame.__init__ 部分代码如下 self.Bind(wx.EVT_BUTTON, self.onClickBuildLibButton, self.buildLibButton) self.Bind(wx.EVT_CLOSE, self.onWindowClose, self.frame) # end wxGlade 将生成的代码 self.frame 改为 self,运行正常 # self.Bind(wx.EVT_CLOSE, self.onWindowClose, self.frame) self.Bind(wx.EVT_CLOSE, self.onWindowClose, self)