Previous topic


Next topic


This Page

Quick links


class psychopy.visual.CustomMouse(win, newPos=None, visible=True, leftLimit=None, topLimit=None, rightLimit=None, bottomLimit=None, showLimitBox=False, clickOnUp=False, pointer=None, name=None, autoLog=None)

Class for more control over the mouse, including the pointer graphic and bounding box.

Seems to work with pyglet or pygame. Not completely tested.

Known limitations: - only norm units are working - getRel() always returns [0,0] - mouseMoved() is always False; maybe due to

self.mouse.visible == False -> held at [0,0]
  • no idea if clickReset() works

Author: Jeremy Gray, 2011

Class for customizing the appearance and behavior of the mouse.

Use a custom mouse for extra control over the pointer appearance and function. It’s probably slower to render than the regular system mouse. Create your visual.Window before creating a CustomMouse.

: required, visual.Window

the window to which this mouse is attached

: True or False

makes the mouse invisible if necessary

: None or [x,y]

gives the mouse a particular starting position

leftLimit :

left edge of a virtual box within which the mouse can move

topLimit :

top edge of virtual box

rightLimit :

right edge of virtual box

bottomLimit :

lower edge of virtual box

: default is False

display the boundary within which the mouse can move.

pointer :

The visual display item to use as the pointer; must have .draw() and setPos() methods. If your item has .setOpacity(), you can alter the mouse’s opacity.

: when to count a mouse click as having occurred

default is False, record a click when the mouse is first pressed down. True means record a click when the mouse button is released.


CustomMouse is a new feature, and subject to change. setPos() does not work yet. getRel() returns [0,0] and mouseMoved() always returns False. clickReset() may not be working.

mro() → list

return a type’s method resolution order