psychopy.org | Reference | Downloads | Github

Type keyboard response on mouse clicked positions

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): v1.90.2 and also PsychoPy 2020.1.3
Standard Standalone? (y/n) If not then what?: Yes
What are you trying to achieve?:
I am trying to display the responses typed with the keyboard above the (mouse) clicked positions. So basically, subject clicks on a position on the stimulus and above that position they type their response with the keyboard. They can click on multiple positions, and each time they click they should type their response. Then, when they are finished they click on a button to move on the next trial.

What did you try to make it work?:
I tried to set the position of the responseText by inserting following ‘responseText.setPos(mouse.getPos(), log=False)’ at each frame tab.

What specifically went wrong when you tried that?:
The responses are shown above the mouse icon, not at the clicked positions. And weirdly, they re-appear on the next trial.

mouse.getPos is going to update every frame. You should set the position to an array variable when the mouse is clicked and then set the position of the text to that variable.

Thanks a lot for your response, it worked. But the responses still re-appear in the next trial. Do you have a guess why could that be?

What are you doing to reset the text at the start of the routine?

The mouse location and button will be recorded based on the previous location.

Thanks, again! I fixed it by resetting the responseText in the beginning of the routine.