psychopy.org | Reference | Downloads | Github

Problems with internal t

OS : Win10
PsychoPy version : v2021.1.4
What are you trying to achieve?:
I am trying to end a trial on a mouse event and collect the reaction time.

The goal is to click anywhere on the screen and to end the routine on the mouse click. In a further step it would be nice if i the mouse event would start 1 sec after the visual stimuli but i am still struggling with collecting the reaction time at all.

What did you try to make it work?:

I am working with two screens which are defined in a first component

win1 = visual.Window(
size=[1920, 1080], screen=0, allowGUI=False,
monitor="Monitor", color=[-1,-1,-1], colorSpace="rgb",
units="pix")

win2 = visual.Window(
size=[1680,1050], screen=1,allowGUI=False,
monitor="tablet", color=[-1,-1,-1], colorSpace="rgb",
units="pix")

In a second component in the “each Frame” tab I create two stimuli (one on each screen) and a mouse event.

left_text = visual.TextStim(win1, text="Left", flipHoriz=True)
left_text.draw()
right_text = visual.TextStim(win2, text="Right", flipHoriz=True)
right_text.draw()

mouse = event.Mouse(visible = False, win = win2)

Than i wrote a code where the routine is finished and the mouse coordinates and reaction time is collected

while mouse.getPressed()[0]==0:
    left_text.draw()
    right_text.draw()
    win1.flip()
    win2.flip()
if mouse.getPressed()[0] == 1:
    thisExp.addData("mouse.Pos.x", mouse.getPos()[0])
    thisExp.addData("mouse.Pos.y", mouse.getPos()[1])
    thisExp.addData("mouse.t",t)
    continueRoutine = False

mouse.clickReset()

What specifically went wrong when you tried that?:

The mouse.t Data is completely messed up. I get reaction times like 0.005 even though i actually waited 3 seconds.
I have no idea were this error arises but i need to fix “t” so i can work with it later to start the mouse and stimuli with the correct timing