希望获得有关使用degFlat或degFlatPos的一些建议。
除非我想使用自定义鼠标(visual.CustomMouse),否则它可以正常工作。我想知道是否有其他人在将这两者结合使用方面取得了成功?
例如,快速修改customMouse.py演示:
from psychopy import visual, event, monitors
mon = monitors.Monitor('TVscreen1')
mon.setDistance(30)
mon.setSizePix([1920,1080])
mon.setWidth(40)
myWin = visual.Window(units='degFlat', monitor=mon)
vm = visual.CustomMouse(myWin, leftLimit=-0.2, topLimit=0, rightLimit=0.2, bottomLimit=-0.4,
showLimitBox=True, clickOnUp=True)
instr = visual.TextStim(myWin,text="move the mouse around.\nclick to give the mouse more room to move.", pos=(0,.3))
new_pointer = visual.TextStim(myWin, text='o')
print("[getPos] [getWheelRel] click time")
while not event.getKeys():
instr.draw()
vm.draw()
myWin.flip()
if vm.getClicks():
vm.resetClicks()
#vm.setVisible(not vm.getVisible()) # can use get & set; here, a click toggles mouse visibility
print("click at [%.2f, %.2f]" % (vm.getPos()[0],vm.getPos()[1]))
print(vm.getWheelRel())
print("%.3f sec"%vm.mouseMoveTime())
vm.setLimit(leftLimit = -0.7, rightLimit = 0.7, bottomLimit = -0.8) # can set some limits, others are unchanged
instr.setText("any key to quit")
vm.pointer = new_pointer # switch the pointer appearance to anything with a .draw() and setPos() method
给出了这个错误:
[getPos] [getWheelRel] click time
Traceback (most recent call last):
File "C:\Users\Peter\Desktop\customMouse1.py", line 23, in <module>
vm.draw()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\custommouse.py", line 153, in draw
self._setPos()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\custommouse.py", line 133, in _setPos
pos = self.getPos()
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\custommouse.py", line 145, in getPos
dx, dy = self.getRel()
TypeError: 'NoneType' object is not iterable
谢谢,Nisha