Skip to content

ipygame.mouse

pygame-compatible mouse module.

class Cursor()

Minimal cursor representation (cursors can’t be changed in Jupyter).

def __init__(*args, **kwargs)

def get_pressed(num_buttons: int = 3,
desktop: bool = False) -> tuple[bool, ...]

Get the state of mouse buttons.

def get_just_pressed() -> tuple[bool, bool, bool, bool, bool]

Get buttons that were just pressed this frame.

def get_just_released() -> tuple[bool, bool, bool, bool, bool]

Get buttons that were just released this frame.

def get_pos(desktop: bool = False) -> tuple[int, int]

Get the current mouse position.

def get_rel() -> tuple[int, int]

Get relative mouse movement since last call.

def set_pos(pos=None, x: int | None = None, y: int | None = None) -> None

Set the mouse position (no-op in Jupyter — cursor is OS-controlled).

def set_visible(value: bool) -> int

Hide or show the mouse cursor.

def get_visible() -> bool

Get cursor visibility state.

def get_focused() -> bool

True when the display is receiving mouse input.

def set_cursor(*args, **kwargs) -> None

Set the mouse cursor (no visual effect in Jupyter).

def get_cursor() -> Cursor

Get the current mouse cursor.

def get_relative_mode() -> bool

Query relative mouse mode.

def set_relative_mode(enable: bool) -> None

Enable or disable relative mouse mode.