def t2(): w = visual.Window(screen=1, fullscr=True, units='pix') m = visual.CustomMouse(w, visible=False, leftLimit=1900, topLimit=20) t_end = core.getTime() + 20 while core.getTime() < t_end: m.draw() core.wait(0.010) w.close()
Demo of CustomMouse(), showing movement limits, click detected upon release, and ability to change the pointer. """ from __future__ import division from __future__ import print_function # author Jeremy Gray from psychopy import visual, event win = visual.Window() # a virtual mouse, vm, : vm = visual.CustomMouse(win, leftLimit=-0.2, topLimit=0, rightLimit=0.2, bottomLimit=-0.4, showLimitBox=True, clickOnUp=True) instr = visual.TextStim(win, text="move the mouse around.\n" "click to give the mouse more room to move.", pos=(0, .3)) new_pointer = visual.TextStim(win, text='o') print("[getPos] [getWheelRel] click time") while not event.getKeys(): instr.draw() vm.draw() win.flip() if vm.getClicks(): vm.resetClicks() # vm.setVisible(not vm.getVisible()) print("click at [%.2f, %.2f]" % (vm.getPos()[0], vm.getPos()[1])) print(vm.getWheelRel())
myExpt.errorMessage('BUG', 'Number of stimuli ('+len(img_dict)+') does not match the specified number of unique trials ('+str(expt.uniqueTrialN)+').') expt.escapeExpt() ######## ######## ###### ######## ####### ## ## ###### ######## ## ## ## ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## ## ## ## #### ## ## ## ######## ###### ###### ######## ## ## ## ## ## ###### ###### ## ## ## ## ## ## ## ## #### ## ## ## ## ## ## ## ## ## ## ## ### ## ## ## ## ## ######## ###### ## ####### ## ## ###### ######## CENTER_POSITION = (int(round(expt.winWidth/2.0)), int(round(expt.winHeight/2.0))) # cursor mouse = visual.CustomMouse(expt.w, clickOnUp=True, pointer=None) controlled_mouse = pynput.mouse.Controller() ######## ### ######## ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ######### ## ######### ## ## ## ## ## ## ## ######## ## ## ## ## ## DATA_TITLES = [ 'subjNo', 'blockNo', 'trialNo',