Step Locating the binder object

The ProcessEvent() method then looks for a binder object that recognizes a binding between the event type and the current object.

If a binder isn't found for the object itself, the processing walks up the class hierarchy to find a binder defined in a superclass of the object—this is different than the walk up in the container hierarchy that happens in the next step. If a binder object is found, wxPy-thon calls the associated handler function. After the handler is called, event processing stops for that event, unless the handler function explicitly asks for more processing.

In listing 3.3, the mouse enter event is captured, and because there is a defined binding between the button object, the binder object wx.evt_enter_window, and the associated method OnEnterWindow(), the method is called. Since we don't bind the mouse button click event, wx.EVT_LEFT_DOWN, wxPython would keep searching in that case.

Was this article helpful?

0 0

Post a comment