import wx class MainWindow(wx.Frame): """ We simply derive a new class of Frame. """ def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(640,480)) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.control = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE) self.CreateStatusBar() self.Show(True) def OnKeyDown(self, event): if event.GetKeyCode() == wx.WXK_CONTROL: self.control.AppendText('control') app = wx.PySimpleApp() frame=MainWindow(None, wx.ID_ANY, 'Small editor') app.MainLoop()