In my app I have lots of dialogs/frames and all have AcceleratorTable so they would get closed when pressing the ESC key.
used code like this:
accelTable = wx.AcceleratorTable([(wx.ACCEL_NORMAL, wx.WXK_ESCAPE, b.GetId())])
self.SetAcceleratorTable(accelTable)
where b is a close button.
It works with 2.6, but not with 2.7 or 2.8.
First, accelerators send EVT_MENU events, so you need to bind EVT_MENU to the frame, using the id you use in the accelerator table. Second, on Linux you only get events from accelerators if a control in the frame has the focus, and when a frame is opened it doesn't automatically find a focusable control within the frame like the other platforms do. Once the button gets the focus then the accelerator will work there. Finally, the ESC keypress not resulting in an accelerator event on Windows does look like a bug, please enter a bug report about it using a category of "wxMSW Specific".
ยทยทยท
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!