def on_mouse_press(self, x, y, button, modifiers): ''' An event intended to be triggered by the window object. Triggers every time the user moves the mouse. ''' for hotspot in State.view().hotspots: if hotspot.contains(x, y): self.dispatch_event('on_hotspot_click', hotspot, button, modifiers)
def on_mouse_motion(self, x, y, dx, dy): ''' An event intended to be triggered by the window object. Triggers every time the user moves the mouse. ''' for hotspot in State.view().hotspots: if hotspot.contains(x, y): self.dispatch_event('on_mouse_hover', hotspot, x, y) return # If the mouse is not over any hotspot, send an event to clear the hotspots. self.dispatch_event('on_mouse_hover', None)