[solved] Mouse Button Down Event?
Does anyone have any experience of recording whether a mouse button is being held down? As in not just a click, but holding the button down like you would when dragging a window. I have experimented with the mouse.getpressed function but this doesn't seem to distinguish between click then release, and click then hold.
Alternatively, is there a way to record (on the android version) whether an area of the screen is being touched? I would like to make an event that only occurs when a participant lifts their finger off the screen.
Thanks!
Comments
Hi George,
Me myself, I don't have much experience with mouse button down events or the android version. However, I'm quite sure that what you describe should be doable with OpenSesame. Maybe, you could have a look on this discussion? It seems to have a similar topic that your question has.
Good luck and let us know if you need more help.
Eduard
Hi George,
The
openexp.mouse.mouse.get_presseddoes give information on which buttons are down!It returns a Boolean vector, basically a tuple with a 1/0 (down/up) value for all buttons. If you want participants to be able to drag something, you could very easily use the
get_pressedoutput. Example:On your second question, of specifically picking up button releases: you could monitor the
get_pressedoutput and check for transitions of 1 to 0. Alternatively, you could use PyGame directly (this is the underlying library for both the legacy and droid back-ends). To do this, you will need to monitorpygame.event.get()for apygame.MOUSEBUTTONUPevent (for more info, see the PyGame documentation).Good luck!
Thanks eduard and Edwin, that is really helpful. I have the task working now. My mistake on the mouse.get_pressed function!