API Reference
adafruit_cursorcontrol.cursorcontrol
Mouse cursor for interaction with CircuitPython UI elements.
Author(s): Brent Rubell
Implementation Notes
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class adafruit_cursorcontrol.cursorcontrol.Cursor(display: BusDisplay | EPaperDisplay | framebufferio.FramebufferDisplay | None = None, display_group: displayio.Group | None = None, bmp: displayio.Bitmap | None = None, is_hidden: bool = False, cursor_speed: int = 5, scale: int = 1)
Mouse cursor interaction for CircuitPython.
- Parameters:
display (~AnyDisplay) – CircuitPython display object.
display_group (Group) – CircuitPython group object to append the cursor to.
bmp (Bitmap) – CircuitPython bitmap object to use as the cursor
is_hidden (bool) – Cursor is hidden on init.
cursor_speed (int) – Speed of the cursor, in pixels.
scale (int) – Scale amount for the cursor in both directions.
Example for creating a cursor layer
from adafruit_cursorcontrol import Cursor # Create the display display = board.DISPLAY # Create the display context splash = displayio.Group() # initialize the mouse cursor object mouse_cursor = Cursor(display, display_group=splash)
- property cursor_bitmap: displayio.Bitmap
Return the cursor bitmap.
- generate_cursor(bmp: displayio.Bitmap) None
Generates a cursor icon
- Parameters:
bmp (Bitmap) – A Bitmap to use for the cursor
Returns True if the cursor is hidden or visible on the display.
adafruit_cursorcontrol.cursorcontrol_cursormanager
Simple interaction user interface interaction for Adafruit_CursorControl. * Author(s): Brent Rubell
- class adafruit_cursorcontrol.cursorcontrol_cursormanager.CursorManager(cursor: Cursor, shift_register_keys: ShiftRegisterKeys | None = None)
Simple interaction user interface interaction for Adafruit_CursorControl.
- Parameters:
cursor (Cursor) – The cursor object we are using.
shift_register_keys (ShiftRegisterKeys) – Optional initialized ShiftRegisterKeys object to use instead of having CursorManager initialize and control it.
- property is_alt_clicked: bool
Returns True if the cursor B button was pressed during previous call to update()
- property is_clicked: bool
Returns True if the cursor A button was pressed during previous call to update()
- property is_select_clicked: bool
Returns True if the Select button was pressed during previous call to update()
- class adafruit_cursorcontrol.cursorcontrol_cursormanager.DebouncedCursorManager(cursor: Cursor, debounce_interval: float = 0.01)
Simple user interface interaction for Adafruit_CursorControl. This subclass provide a debounced version on the A, B, Start or Select buttons and provides queries for when the buttons are just pressed, and just released, as well their current state. “Just” in this context means “since the previous call to update.”
- Parameters:
cursor (Cursor) – The cursor object we are using.
- property alt_released: bool
Returns True if the cursor B button was released during previous call to update()
- property is_alt_clicked: bool
Returns True if the cursor B button was pressed during previous call to update()
- property is_clicked: bool
Returns True if the cursor A button was pressed during previous call to update()
- property is_select_clicked: bool
Returns True if the Select button was pressed during previous call to update()
- property is_start_clicked: bool
Returns True if the Start button was pressed during previous call to update()
- property released: bool
Returns True if the cursor A button was released during previous call to update()
- property select_released: bool
Returns True if the cursor Select button was released during previous call to update()