Hello, I’m trying to design a mouse tracking experiment.
What I wanna design are as followings:
- show two stimulus(named stimulus and tent) and mouse cursor
- cursor moves accordingly to mouse position
- store 1) the position of mouse in every frame and 2) which stimuli has the mouse clicked 3) time when the mouse clicked has been made
- the maximum duration of this trial is 2sec, but terminate the trial if mouse click has been made earlier
It’s my first time designing task with coder, so there would be lots of mistakes here. I hope someone could help me out!
(I haved defined the drawer function to show stimuli previously)
mouse = event.Mouse(visible = True) mouse.clickReset() mouse_pos=np.zeros((200,2)) mouse_click_time= mouse_click_name= self.drawer.draw_stimulus() self.drawer.draw_tent() self.window.flip() for nFrames in range(200): mouse_pos[nFrames,:] = mouse.getPos() if mouse.getPressed(): if mouse.isPressedIn(tent, buttons=): mouse_click_name.append('tent') else: mouse_click_name.append('stimulus') mouse_click_time = mouse.getPressed(getTime=True)