psychopy 记录最后一次鼠标滚轮移动的时间
psychopy record time of last mouse scroll wheel movement
我需要记录每次试验最后一次移动滚轮的时间。我有针对按键执行此操作的代码(lastTrialTime
变量):
lastTime = 0 # setting up to get RT at last key press
while timer.getTime() >0: # while time isn't up (turns neg when time's up)
for key in event.getKeys():
if key in ['escape']:
core.quit() # quit if they press escape
if key in ['b']:
# add keypress to list for each keypress. then move cursor proportionally to length of this list
b_list.append(key)
prevPos+=len(b_list)
lastTime = clock.getTime()
if key in ['t']:
t_list.append(key)
prevPos-=len(t_list)
lastTime = clock.getTime()
lastTrialTime = lastTime
但我不确定如何针对鼠标响应执行此操作。我使用以下代码行来获取滚轮在每次刷新时移动了多少。
wheel_dX, wheel_dY = myMouse.getWheelRel()*4
但是,我不知道如何使用它(或其他东西?)来制作一个包含 clock.getTime()
调用最后一次滚轮移动的变量。
您可以测试值是否为 0:
wheel_dX, wheel_dY = myMouse.getWheelRel()*4
if any([wheel_dX, wheel_dY]):
lastTime = clock.getTime()
我需要记录每次试验最后一次移动滚轮的时间。我有针对按键执行此操作的代码(lastTrialTime
变量):
lastTime = 0 # setting up to get RT at last key press
while timer.getTime() >0: # while time isn't up (turns neg when time's up)
for key in event.getKeys():
if key in ['escape']:
core.quit() # quit if they press escape
if key in ['b']:
# add keypress to list for each keypress. then move cursor proportionally to length of this list
b_list.append(key)
prevPos+=len(b_list)
lastTime = clock.getTime()
if key in ['t']:
t_list.append(key)
prevPos-=len(t_list)
lastTime = clock.getTime()
lastTrialTime = lastTime
但我不确定如何针对鼠标响应执行此操作。我使用以下代码行来获取滚轮在每次刷新时移动了多少。
wheel_dX, wheel_dY = myMouse.getWheelRel()*4
但是,我不知道如何使用它(或其他东西?)来制作一个包含 clock.getTime()
调用最后一次滚轮移动的变量。
您可以测试值是否为 0:
wheel_dX, wheel_dY = myMouse.getWheelRel()*4
if any([wheel_dX, wheel_dY]):
lastTime = clock.getTime()