ipygame.mouse
pygame-compatible mouse module.
Cursor Objects
Section titled “Cursor Objects”class Cursor()Minimal cursor representation (cursors can’t be changed in Jupyter).
__init__
Section titled “__init__”def __init__(*args, **kwargs)get_pressed
Section titled “get_pressed”def get_pressed(num_buttons: int = 3, desktop: bool = False) -> tuple[bool, ...]Get the state of mouse buttons.
get_just_pressed
Section titled “get_just_pressed”def get_just_pressed() -> tuple[bool, bool, bool, bool, bool]Get buttons that were just pressed this frame.
get_just_released
Section titled “get_just_released”def get_just_released() -> tuple[bool, bool, bool, bool, bool]Get buttons that were just released this frame.
get_pos
Section titled “get_pos”def get_pos(desktop: bool = False) -> tuple[int, int]Get the current mouse position.
get_rel
Section titled “get_rel”def get_rel() -> tuple[int, int]Get relative mouse movement since last call.
set_pos
Section titled “set_pos”def set_pos(pos=None, x: int | None = None, y: int | None = None) -> NoneSet the mouse position (no-op in Jupyter — cursor is OS-controlled).
set_visible
Section titled “set_visible”def set_visible(value: bool) -> intHide or show the mouse cursor.
get_visible
Section titled “get_visible”def get_visible() -> boolGet cursor visibility state.
get_focused
Section titled “get_focused”def get_focused() -> boolTrue when the display is receiving mouse input.
set_cursor
Section titled “set_cursor”def set_cursor(*args, **kwargs) -> NoneSet the mouse cursor (no visual effect in Jupyter).
get_cursor
Section titled “get_cursor”def get_cursor() -> CursorGet the current mouse cursor.
get_relative_mode
Section titled “get_relative_mode”def get_relative_mode() -> boolQuery relative mouse mode.
set_relative_mode
Section titled “set_relative_mode”def set_relative_mode(enable: bool) -> NoneEnable or disable relative mouse mode.