Connecting Tech Pros Worldwide Help | Site Map

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

  #1  
Old January 15th, 2007, 12:38 AM
bartonc's Avatar
Moderator
 
Join Date: Sep 2006
Location: Minden, Nevada, USA
Posts: 6,400
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; November 20th, 2007 at 07:34 PM.



Reply