pyglet.window.mouse

Mouse constants and utilities for pyglet.window.

class MouseStateHandler

Simple handler that tracks the state of buttons from the mouse. If a button is pressed then this handler holds a True value for it.

For example:

>>> win = window.Window()
>>> mousebuttons = mouse.MouseStateHandler()
>>> win.push_handlers(mousebuttons)

# Hold down the "left" button...

>>> mousebuttons[mouse.LEFT]
True
>>> mousebuttons[mouse.RIGHT]
False
buttons_string(buttons)

Return a string describing a set of active mouse buttons.

Example:

>>> buttons_string(LEFT | RIGHT)
'LEFT|RIGHT'
Parameters:buttons (int) – Bitwise combination of mouse button constants.
Return type:str