Many modern mice and keyboard have more or less useful fancy extra buttons, like forward and backwards buttons used when browsing the Internet. Unfortunately, the hardware manufacturers haven't agreed on a standard for handling these mice, which makes it hard for application programmers to add support for such buttons. = On Windows = == Logitech devices == These drivers emit key combinations; '''alt+numpad right''' for forward, '''alt+numpad left''' for backwards. To handle this, you just need a handler for wx.EVT_CHAR: {{{#!python def OnChar(self, event): if event.AltDown() and event.GetKeyCode() == wx.WXK_NUMPAD_RIGHT: cp = self.GetDocument().GetCommandProcessor().Redo() if event.AltDown() and event.GetKeyCode() == wx.WXK_NUMPAD_LEFT: cp = self.GetDocument().GetCommandProcessor() if cp.CanUndo(): cp.Undo() }}} == Microsoft devices == Microsoft has documented their behaviour very well. See for example [[http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/BestPracticesforSupportingMicrosoftMouseandKeyboardDevices.asp|this article]] from MSDN. They defined a few new windows messages for this. To handle these messages I think you need to hook into the raw windows message flow (see HookingTheWndProc). I'm not an expert on wxPython, so I don't know if there's a better way of doing it. The message you need to detect is the [[http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputmessages/wm_appcommand.asp|WM_APPCOMMAND]], which has the numerical ID 0x0319. I have no idea how to implement similar behaviour on linux, but feel free to add that. Or if you have a better way of handling the WM_APPCOMMAND.