我正在使用pygame窗口通过pylink命令执行eylink校准。初始化显示时会触发错误(display.set\模式)地址:
pygame.error: DirectDraw2 : : CreateSurface: Undefined error.
我已经使用同一个代码好几年了,但没有成功触发错误,它偶尔发生,回溯似乎很模糊。我在下面粘贴了执行校准的函数。你知道吗
if key == ['k']:
win.clearBuffer()
win.flip()
return win, None
elif key == ['r']:
win.close()
display.init()
display.set_mode(resolution, FULLSCREEN |DOUBLEBUF,32)
pylink.openGraphics()
print 'This is a monocular calibration routine. Please select the appropriate eye.'
# set calibration colors (target, background)
pylink.setCalibrationColors((255, 255, 255), (0, 0, 0))
# set calibration target size (diameter, hole)
pylink.setTargetSize(int(0.25 * degToPix), int(0.05 * degToPix))
# set calibration sounds
pylink.setCalibrationSounds('', '', '')
pylink.setDriftCorrectSounds('', 'off', 'off')
# custom calibration routine: randomize and repeat first target must be turned off inside EYELINK
# 5 1 6
# 9 10
# 3 0 4
# 11 12
# 7 2 8
EYELINK.sendCommand('calibration_type = HV9')
EYELINK.sendCommand('generate_default_targets = NO')
EYELINK.sendCommand('calibration_targets = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d' % eyeCoordsR)
EYELINK.sendCommand('validation_targets = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d' % eyeCoordsR)
EYELINK.doTrackerSetup()
pylink.closeGraphics()
display.quit()
win = ps.visual.Window(resolution, units = 'pix', fullscr = True, screen = 1, color = (0, 0, 0), colorSpace = 'rgb255', useFBO = False)
return win, None
elif key == ['l']:
win.close()
display.init()
display.set_mode(resolution, FULLSCREEN |DOUBLEBUF,32)
pylink.openGraphics()
print 'This is a monocular calibration routine. Please select the appropriate eye.'
# set calibration colors (target, background)
pylink.setCalibrationColors((255, 255, 255), (0, 0, 0))
# set calibration target size (diameter, hole)
pylink.setTargetSize(int(0.25 * degToPix), int(0.05 * degToPix))
# set calibration sounds
pylink.setCalibrationSounds('', '', '')
pylink.setDriftCorrectSounds('', 'off', 'off')
# custom calibration routine: randomize and repeat first target must be turned off inside EYELINK
# 5 1 6
# 9 10
# 3 0 4
# 11 12
# 7 2 8
EYELINK.sendCommand('calibration_type = HV9')
EYELINK.sendCommand('generate_default_targets = NO')
EYELINK.sendCommand('calibration_targets = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d' % eyeCoordsL)
EYELINK.sendCommand('validation_targets = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d' % eyeCoordsL)
EYELINK.doTrackerSetup()
pylink.closeGraphics()
display.quit()
win = ps.visual.Window(resolution, units = 'pix', fullscr = True, screen = 1, color = (0, 0, 0), colorSpace = 'rgb255', useFBO = False)
return win, None
elif key == ['e']:
print '\t Exit? YES (Y) or NO (N)'
key = ps.event.waitKeys(keyList = ['y', 'n'])
if key == ['y']:
return win, True
elif key == ['n']:
return win, False
目前没有回答
相关问题 更多 >
编程相关推荐