def generateEnterLeave(self, x, y, element):
        # XXX this would possibly be simpler if we could ask whether
        # elements handled the on_element_enter event

        # see which elements (starting with the one under the mouse and
        # moving up the parentage) care about an on_element_enter event
        enter = []
        over = []
        e = element
        while e:
            if not e.isEnabled():
                e = e.parent
                continue
            if e in self.entered_elements:
                # remain over
                over.append(e)
            else:
                enter.append(e)
            e = e.parent

        # right, now "leave" any elements that aren't in "enter" any more
        # (only if they still exist)
        all = enter + over
        for e in self.entered_elements:
            if all not in e and self.has('#'+e.id):
                self.dispatch_event(e, 'on_element_leave', x, y,
                    propogate=False)

        # and now generate enter events
        for e in enter:
            if self.dispatch_event(e, 'on_element_enter', x, y,
                    propogate=False)[1]:
                over.append(e)

        #if mouse stable (not moving)? and 1 second has passed
        #    element.on_element_hover(x, y)

        # remember the elements we're over for later _leave events
        self.entered_elements = over
dataset/ETHPy150Open ardekantur/pyglet/contrib/wydget/wydget/event.py/GUIEventDispatcher.generateEnterLeave/swapped operands of `not in`