[wxPython] event handlers

I am wondering about how EVT_XXX handles multiple calls. I want to change
how events are handled depending upon which mode my program is in. If I call
EVT_XXX multiple times for the same event, each time pointing to a different
method, are these event handlers chained or do subsequent calls replace the
old event handler?

···

--
Cliff Wells
Software Engineer
Logiplex Corporation
(800) 735-0555

I am wondering about how EVT_XXX handles multiple calls. I want to change
how events are handled depending upon which mode my program is in. If I

call

EVT_XXX multiple times for the same event, each time pointing to a

different

method, are these event handlers chained or do subsequent calls replace

the

old event handler?

Each instance of a class derived from wxEvtHandler has a static event table,
which is used only by C++ code, and a dynamic event table (just a list
really) which is what wxPython uses although a few C++ developers use it
too. Every time you call a EVT_XXX function it adds an entry to this list.
When an event happens the first matching handler in the event table is
called, and if it calls event.Skip() then the search continues so if another
match is found then it is called too.

The EVT_XXX functions are really just convenience wrappers around the
wxEvtHandler.Connect method. There is also a .Disconnect method that you
can call if needed to remove an event handler binding.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!