def MousePos(widget=None): pos = Experiment._last_instance()._app.mouse_pos_ref if widget is None: return pos else: return Ref.cond(MouseWithin(widget), Ref(map, operator.sub, pos, widget.pos), None)
def MouseButton(widget=None): """Returns a Reference to the next mouse button to be pressed. If given a widget, it will only return the mouse button pressed if it was pressed while the mouse was within the widget. If not given a widget, it will return a reference to the next button to be pressed on the mouse. """ button = Experiment._last_instance()._app.mouse_button_ref if widget is None: return button else: return Ref.cond(MouseWithin(widget), button, None)
def MouseButton(widget=None): """Returns a Reference to the next mouse button to be pressed. If given a widget, it will only return the mouse button pressed if it was pressed while the mouse was within the widget. If not given a widget, it will return a reference to the next button to be pressed on the mouse. """ button = Experiment._last_instance().screen.mouse_button if widget is None: return button else: return Ref.cond(MouseWithin(widget), button, None)
def MousePos(widget=None): """Returns the position of the mouse. If given a widget, this function will return the position of the mouse in reference to the position of the widget. If widget is set to None, then this function will return the mouse position in relation to the experiment window. """ pos = Experiment._last_instance()._app.mouse_pos_ref if widget is None: return pos else: return Ref.cond(MouseWithin(widget), Ref(map, operator.sub, pos, widget.pos), None)
def MousePos(widget=None): """Returns the position of the mouse. If given a widget, this function will return the position of the mouse in reference to the position of the widget. If widget is set to None, then this function will return the mouse position in relation to the experiment window. """ pos = Experiment._last_instance().screen.mouse_pos if widget is None: return pos else: return Ref.cond(MouseWithin(widget), Ref(map, operator.sub, pos, widget.pos), None)
def MouseButton(widget=None): button = Experiment._last_instance()._app.mouse_button_ref if widget is None: return button else: return Ref.cond(MouseWithin(widget), button, None)