【问题标题】:PsychoPy Recording Multiple Mouse ClicksPsychoPy 记录多次鼠标点击
【发布时间】: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


    【解决方案1】:

    大概你有某种方式知道参与者已经“完成”了。您可以执行while 循环,直到满足退出条件。您只需循环通过鼠标功能收集数据并将其附加到稍后将保存的某个列表,直到满足退出条件。基本的伪代码方法类似于:

    while 1:
       catchData = getMouseClickStuff()
       <append catchData to whatever list it should be stored to>
       if <endConditionMet>:
          break
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-26
      相关资源
      最近更新 更多