Escape key event problem in wxPython?
- by MA1
Hi All
The following key event is not working. Any idea?
class Frame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, title='testing', size=(300,380), style= wx.MINIMIZE_BOX|wx.SYSTEM_MENU
|wx.CAPTION|wx.CLOSE_BOX|wx.CLIP_CHILDREN)
self.tree = HyperTreeList(self, style = wx.TR_DEFAULT_STYLE |
wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_HAS_VARIABLE_ROW_HEIGHT | wx.TR_HIDE_ROOT)
# create column
self.tree.AddColumn("coll")
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
def OnKeyDown(self, event):
keycode = event.GetKeyCode()
print "keycode ", keycode
if keycode == wx.WXK_ESCAPE:
print "closing"
self.Close()
Regards,