wxPython: Intercepting keyboard events from multiple widgets?

Donnal Walter donnal at donnal.net
Thu Apr 17 05:39:07 EDT 2003


Greg Ewing (using news.cis.dfn.de) wrote:
> 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?


Would an accelerator table do the job?

http://www.wxwindows.org/manuals/2.4.0/wx28.htm#wxacceleratortable

You might also take a look at wxPython.lib.evtmgr.py

Regards,
Donnal Walter
Arkansas Children's Hospital







More information about the Python-list mailing list