Is there a wx.EVT that is raised when the mouse is clicked anywhere, irrespective of the mouse position? Likewise, is any event raised when a key is pressed, irrespective of which widget has focus?
I’m thinking that, if no such event exists, maybe I can capture the mouseclick/keypress in OnIdle, if there’s an OS call to detect “mouse button down” or “key down”. Any such OS call available?
For the most part, I think you can use EVT_LEFT_DOWN or EVT_LEFT_UP for your mouse click events when bound to the frame, assuming you’re talking about clicking inside your application. When you’re outside the application, there is no wx hooks to use that I’m aware of. The same is mostly true to key events. Most of the time, EVT_KEY_DOWN is all you need. However, there are some widgets that can eat key events, like TextCtrls. What are you trying to do anyway?
Is there a wx.EVT that is raised when the mouse is clicked anywhere,
irrespective of the mouse position? Likewise, is any event raised when
a key is pressed, irrespective of which widget has focus?
Mouse and key events are normally only sent to the widget in which they happen (the widget with the focus for key events.) However a widget can use CaptureMouse to get all mouse events where ever they happen, just be sure to use ReleaseMouse when done and be prepared to handle the EVT_MOUSE_CAPTURE_LOST event.
There it not anything like that for key events however, but depending on what you actually need you may be able to get it done by adding accelerators to your menu items or by using an AcceleratorTable.
I'm thinking that, if no such event exists, maybe I can capture the
mouseclick/keypress in OnIdle, if there's an OS call to detect "mouse
button down" or "key down". Any such OS call available?
You can get the current state of the mouse (positions, buttons pressed and active modifier keys) using wx.GetMouseState(). There is also wx.GetKeyState that can be used to check specific keys although I think it may not be fully functional on all platforms.