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 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
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