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. If the window loses focus, all buttons will be reset to False in order to avoid a “sticky” button state.
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
- buttonsint
Bitwise combination of mouse button constants.
- Return type
- LEFT
Constant for the left mouse button.
- MIDDLE
Constant for the middle mouse button.
- MOUSE4
Constant for the mouse4 button.
- MOUSE5
Constant for the mouse5 button.
- RIGHT
Constant for the right mouse button.