import wx class MainFrame(wx.Frame): def __init__(self, parent): super(MainFrame, self).__init__(parent) self.button1 = wx.Button(self, label="Egyik") self.button2 = wx.Button(self, label="Másik") main_box = wx.BoxSizer(wx.VERTICAL) main_box.Add(self.button2) main_box.Add(self.button1) self.SetSizer(main_box) self.Bind(wx.EVT_CHAR_HOOK, self.on_char_hook) def on_char_hook(self, event): code = event.GetKeyCode() print(code) event.Skip() class ValamiApp(wx.App): def OnInit(self): frame = MainFrame(None) frame.Show() return True app=ValamiApp() app.MainLoop()