CustomMouse

class psychopy.visual.CustomMouse(*args, **kwargs)[source]

Class for more control over the mouse, including the pointer graphic and bounding box. This is a lazy-imported class, therefore import using full path from psychopy.visual.custommouse import CustomMouse when inheriting from it.

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.

Parameters:
  • win (required, visual.Window) – the window to which this mouse is attached

  • visible (True or False) – makes the mouse invisible if necessary

  • newPos (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

  • showLimitBox (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.

  • clickOnUp (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.


Back to top