def OnEscapeKey(self, event): keycode = event.GetKeyCode() if keycode == wx.WXK_ESCAPE: self.OnCloseButton(event) else: event.Skip()