def hook_events ( self, ui, control, events = None, handler = None,
                      drop_target = None ):
        if events is None:
            events = (
               wx.wxEVT_LEFT_DOWN, wx.wxEVT_LEFT_DCLICK, wx.wxEVT_LEFT_UP,
               wx.wxEVT_MIDDLE_DOWN, wx.wxEVT_MIDDLE_DCLICK, wx.wxEVT_MIDDLE_UP,
               wx.wxEVT_RIGHT_DOWN, wx.wxEVT_RIGHT_DCLICK, wx.wxEVT_RIGHT_UP,
               wx.wxEVT_MOTION, wx.wxEVT_ENTER_WINDOW, wx.wxEVT_LEAVE_WINDOW,
               wx.wxEVT_MOUSEWHEEL, wx.wxEVT_PAINT
            )
            control.SetDropTarget( PythonDropTarget(
                                   DragHandler( ui = ui, control = control ) ) )
        elif events == 'keys':
            events = ( wx.wxEVT_CHAR, )

        if handler is None:
            handler = ui.route_event

        id            = control.GetId()
        event_handler = EventHandlerWrapper()
        connect       = event_handler.Connect

        for event in events:
            connect( id, id, event, handler )

        control.PushEventHandler( event_handler )

        for child in control.GetChildren():
            self.hook_events( ui, child, events, handler, drop_target )

    #---------------------------------------------------------------------------
    #  Routes a 'hooked' event to the correct handler method:
    #---------------------------------------------------------------------------
Hooks all specified events for all controls in a UI so that they
dataset/ETHPy150Open enthought/traitsui/traitsui/wx/toolkit.py/GUIToolkit.hook_events