WxPython:vent.Skip()-注意堆栈深度

在wxPython中调用旨在扩展事件处理程序功能的方法时,似乎必须考虑堆栈深度。例如,我尝试过:

选择 | 换行 | 行号
  1. #
  2.     def CloseSession(self, event):
  3.         sib = self.sibbling
  4.         pos = self.GetPosition()
  5.         sib.Move(pos)
  6.         sib.Show()
  7.         self.Hide()
  8.         ### allow event processing to continue here ###
  9.         event.Skip()
  10.  
  11.     def OnFeatureDialogClose(self, event):
  12.         self.CloseSession(event)

这看起来应该行得通,但事实并非如此。
因此,请使用:

选择 | 换行 | 行号
  1. #
  2.     def CloseSession(self):
  3.         sib = self.sibbling
  4.         pos = self.GetPosition()
  5.         sib.Move(pos)
  6.         sib.Show()
  7.         self.Hide()
  8.  
  9.     def OnFeatureDialogClose(self, event):
  10.         self.CloseSession()
  11.         ### allow event processing to continue here ###
  12.         event.Skip()

以获得对wx.EVT_CLOSE的正确内部反应。

标签: python

评论已关闭