psychopy.org | Reference | Downloads | Github

Single touchscreen click recorded as many short latency clicks

I recently developed a task where participants make responses by clicking onscreen buttons using a mouse, and am now adapting it to work with touchscreen clicks. For the mouse version, I recorded clicks in a code component using “mouse.isPressedIn”, but as other Psychopy users have found previously, this doesn’t work properly with touchscreen clicks (the onscreen button must be touched and swiped, rather than just touched).
To get around this, I used a solution recommended to someone else who previously had this issue (https://groups.google.com/forum/#!topic/psychopy-users/u5p2yAFGGpg), which uses “image.contains(mouse)” instead of “mouse.isPressedIn” **. Although this solution works inasmuch as a single touchscreen touch is now registered as a click, it creates a new problem in which the single touch is additionally registered as several extremely short-latency clicks (e.g., rt =.004), which causes the experiment to go through the subsequent trials extremely fast (they aren’t even visible). I also had this problem when using the mouse, which I solved by adding mouse.clickReset() in the Begin Routine tab of the code component, but this solution doesn’t work in the touchscreen version, since the trials are now advanced based on the mouse position within an onscreen button rather than an actual click.

I imagine there should be some solution similar to the mouse.clickReset() one - maybe set the position of the mouse to the center of the screen (where there are no buttons) at the beginning of the routine? But I haven’t figured out how to implement one, so feedback would be appreciated.

**I also tried an alternate touchscreen solution suggested by Lily here https://groups.google.com/forum/#!topic/psychopy-users/uJcJb73H630, but it didn’t work for me - it instead caused clicks to no longer do anything.

For anyone encountering this issue in future, after several dead ends, I ultimately solved this issue by:

  1. Setting the mouse position to the center of the screen (where there are no buttons) at both the beginning and end of the routine in a code component. If you have a button in this location, you should set the mouse position to some other location. The beginning and end routine tabs therefore both contain:
mouse.setPos(newPos=(0,0))
  1. Oddly, this worked to prevent psychopy from interpreting a single touch as several short latency touches for all but the first trial of each block following the first block. For some reason, the touch on the last trial of one block was interpreted as a touch on the first trial of the next block (in spite of the mouse position having been reset in between these trials). To fix this, I added a routine at the beginning of each block where the participant has to touch a button in the center of the screen to start the block. This effectively reset the mouse position between blocks (while step 1 reset it between trials within a block).

Hope this helps somebody!

1 Like