def _unpack_event(self, event):

        try:
            point = event.GetPosition()

        except:
            point = event.GetPoint()

        wxid, flags = self.control.HitTest(point)

        # Warning: On GTK we have to check the flags before we call 'GetPyData'
        # because if we call it when the hit test returns 'nowhere' it will
        # barf (on Windows it simply returns 'None' 8^()
        if flags & wx.TREE_HITTEST_NOWHERE:
            data = None

        else:
            data = self.control.GetPyData(wxid)

        return data, wxid, flags, point
Unpacks the event to see whether a tree element was involved.
dataset/ETHPy150Open enthought/pyface/pyface/viewer/tree_viewer.py/TreeViewer._unpack_event