wxPython: Intercepting keyboard events from multiple widgets?

Greg Ewing (using news.cis.dfn.de) ckea25d02 at sneakemail.com
Thu Apr 17 01:43:54 EDT 2003


I have a wxPython problem:

I have a wxNotebook, each wxPanel of which contains a
number of controls.

I want to catch certain keystrokes and use them for
things pertaining to the whole collection of controls,
such as switching from one tab of the notebook to another.

Is there any way I can do this without having to attach
event handlers individually to every control?

In the wxWindows docs under "Pluggable Event Handlers"
it hints at it being possible to do things like
intercepting all the events directed at a dialog box,
but it doesn't go into any details, and it doesn't
seem to be obvious how you would do this. Attaching
an event handler to the dialog itself doesn't seem
like it would work, because keyboard events seem to
originate in whatever control has the keyboard focus
and propagate upwards.

Can anyone point me to an example which shows how
to do this, if it's really possible at all?

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list