def __init__(self, parent=None, *a, **k): wx.StaticText.__init__(self, parent=parent) KeyboardHandler.__init__(self, *a, **k) self.wx_replacements = {} for i in [d for d in dir(wx) if d.startswith('WXK_')]: self.wx_replacements[getattr(wx, i)] = i[4:].lower() self.Bind(wx.EVT_KEY_DOWN, self.process_key, self) self.SetFocus()
def register_key(self, key, function): """key will be a string, such as control+shift+f. We need to convert that, using parse_key, into modifier and key to put into our dictionary.""" #register key so we know if we have it on event receive. t = parse(key) keys[t] = function #if we got this far, the key is valid. KeyboardHandler.register_key(self, key, function)
def unregister_key(self, key, function): KeyboardHandler.unregister_key(self, key, function) del keys[parse(key)]
def __init__(self, *args, **kwargs): KeyboardHandler.__init__(self, *args, **kwargs) t = AtspiThread() t.start()
def unregister_key (self, key, function): KeyboardHandler.unregister_key(self, key, function) del keys[parse(key)]