【发布时间】:2015-06-09 17:03:18
【问题描述】:
我正在使用 PsychoPy 编码器创建一个实验,但不确定如何实现多次鼠标点击。在实验中,有多个目标和干扰因素,在一个响应期间,个人要选择目标。但是,我目前有它,如果您单击其中一个目标,则会收到正确的消息,否则会收到错误的消息。我还有一个功能,它会等待鼠标单击以查找反应时间,并在鼠标单击后给出响应。如何为多个目标添加多次鼠标点击?
def waitForMouse(mouse):
mouse.clickReset()
buttons = mouse.getPressed()
while buttons[0] == False: #wait for mouse click
buttons, times = mouse.getPressed(getTime=True) #get reaction time when mouse clicked
return times[0]
if clock.getTime() >= stimDuration: #start of response period
ResponsePrompt.draw() #indicate to participant to select targets
win.flip()
rt = waitForMouse(myMouse)
if myMouse.isPressedIn(target[0]) or myMouse.isPressedIn(target[1]):
CorrectResp.draw() #selected one of the correct targets
win.flip()
core.wait(2) #allow them to read it
else:
IncorrectResp.draw() #answered incorrectly
win.flip()
core.wait(2)
【问题讨论】:
标签: python mouseevent mouse psychopy