WxPython:vent.Skip()-注意堆栈深度
在wxPython中调用旨在扩展事件处理程序功能的方法时,似乎必须考虑堆栈深度。例如,我尝试过:
选择 | 换行 | 行号
- #
- def CloseSession(self, event):
- sib = self.sibbling
- pos = self.GetPosition()
- sib.Move(pos)
- sib.Show()
- self.Hide()
- ### allow event processing to continue here ###
- event.Skip()
- def OnFeatureDialogClose(self, event):
- self.CloseSession(event)
这看起来应该行得通,但事实并非如此。
因此,请使用:
选择 | 换行 | 行号
- #
- def CloseSession(self):
- sib = self.sibbling
- pos = self.GetPosition()
- sib.Move(pos)
- sib.Show()
- self.Hide()
- def OnFeatureDialogClose(self, event):
- self.CloseSession()
- ### allow event processing to continue here ###
- event.Skip()
以获得对wx.EVT_CLOSE的正确内部反应。
评论已关闭