== Introduction == This recipe is for registering system wide hotkeys--key combinations that are captured whether or not your app/window has the current focus. Works only under MS Windows. == What Objects are Involved == * Any window object or descendant (which is any wx widget) * a function to handle H''''''otKey events (EVT_HOTKEY) * the win32 extensions == Process Overview == First, register the hotkey. Bind the event to the event handler. == Special Concerns == Must have the win32 extensions installed. The Window.R''''''egisterH''''''otKey function takes the win32con.VK_* keycodes, rather than the wx.WVK_* keycodes. == Code Sample == {{{ #!python import wx import win32con #for the VK keycodes class FrameWithHotKey(wx.Frame): def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) self.regHotKey() self.Bind(wx.EVT_HOTKEY, self.handleHotKey, id=self.hotKeyId) def regHotKey(self): """ This function registers the hotkey Alt+F1 with id=100 """ self.hotKeyId = 100 self.RegisterHotKey( self.hotKeyId, #a unique ID for this hotkey win32con.MOD_ALT, #the modifier key win32con.VK_F1) #the key to watch for def handleHotKey(self, evt): """ Prints a simple message when a hotkey event is received. """ print "do hot key actions" }}} === Comments ===