2

SPECS:

  • Using PsychoPy v1.90.3
  • Window 10 Pro 6 running Windows 10

BACKGROUND: I am programming a touchscreen task to use with children (reference image linked below). In the task, children need to press and hold the red 'home' button for 1.5 seconds at the bottom of the screen to advance through trials(i.e., opening the windows at the top of the screen to reveal boxes they can open). I also collect the time of the mouse button being pressed and released (used to calculate response time). I originally programmed this task on my desktop using a mouse, so pressing and holding the home button was no problem using this code:

mouse = event.Mouse(visible=True)

     while not homePressed: 
         if mouse.isPressedIn(home) and home.contains(mouse):                
             core.wait(1.5, hogCPUperiod=1.5)                      ## when home button is pressed, wait for 1.5s
             if mouse.isPressedIn(home) and home.contains(mouse):  ## check if home button is still pressed
               homePressed=True 

When I tried to run the task on the Surface Pro I ran into a problem with the touchscreen not registering a 'press and hold'. I've learned that the touchscreen doesn't register mouse clicks unless the screen has been pressed AND released because a press and hold could be (1) a right click or (2) a swipe. I've tried disabling the 'press and hold' registering as a right-click option on the Surface Pro but this has not solved my issue.

QUESTIONS:

  • Is there a way to get the Surface Pro or PsychoPy to register a press and hold on the touchscreen the same way it does using a mouse so children press the 'home' button down to continue the trials?
  • If yes, can I get PsychoPy to output the 'press' (when the screen is touched) and 'release' (when the touch is no longer present) output the same way it does for a mouse click?
  • If this cannot be accomplished with the PsychoPy library, are there possible python solutions outside of PsychoPy I could try?

SOLUTIONS TRIED:

Jyonehir
  • 21
  • 3

1 Answers1

0

You could try and write a loop that checks the hold time yourself. For example, in a gaze contingent study we have loops to check how long someone has been looking at something, similar to your "hold" variable.

        tCueOn=expClock.getTime()
        while True:
            curtime=expClock.getTime()-tCueOn

            eventType=eyelink.getNextData()         
            sample=eyelink.getNewestSample()

            <<... a bunch of sample processing cut out ...>>

            if curtime>=cueTime:
                break

In your case you detect the press, get the time, and enter the loop where you repeatedly check the press status is still true and that the time is less than 1.5. When it exceeds 1.5 you break the loop, or if they let up for less than 1.5 you return to whereever you need to in your use case. You might find it convenient to bundle this logic in a function that you could just call whenever "press home" is true.

Hope this helps, cheers.

brittAnderson
  • 1,428
  • 11
  • 25