Connecting Tech Pros Worldwide Forums | Help | Site Map

wxPython:event.Skip() - watch out for stack depth

bartonc's Avatar
Moderator
 
Join Date: Sep 2006
Location: Minden, Nevada, USA
Posts: 6,400
#1   Jan 15 '07
When calling methods in wxPython which are intended to extend the fuctionality of an event handler, it appears as though one must take stack depth in to consideration. For example, I tried:
Expand|Select|Wrap|Line Numbers
  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)
which seems like it should work, but doesn't.
So use:
Expand|Select|Wrap|Line Numbers
  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()
to get the correct internal reaction to the wx.EVT_CLOSE.

Last edited by bartonc; Nov 20 '07 at 07:34 PM.



Reply