adafruit_cursorcontrol.cursorcontrol

Mouse cursor for interaction with CircuitPython UI elements.

  • Author(s): Brent Rubell

Implementation Notes

Software and Dependencies:

class adafruit_cursorcontrol.cursorcontrol.Cursor(display=None, display_group=None, bmp=None, is_hidden=False, cursor_speed=5, scale=1)

Mouse cursor interaction for CircuitPython.

Parameters:
  • display (Display) – CircuitPython display object.
  • display_group (Group) – CircuitPython group object to append the cursor to.
  • cursor_speed (int) – Speed of the cursor, in pixels.
  • scale (int) – Scale amount for the cursor in both directions.
  • is_hidden (bool) – Cursor is hidden on init.

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

Return the cursor bitmap.

deinit()

deinitializes the cursor object.

generate_cursor(bmp)

Generates a cursor icon

hidden

Returns True if the cursor is hidden or visible on the display.

hide()

Hide the cursor.

scale

Returns the cursor’s scale amount as an integer.

show()

Show the cursor.

speed

Returns the cursor’s speed, in pixels.

x

Returns the cursor’s x-coordinate.

y

Returns the cursor’s y-coordinate.

adafruit_cursorcontrol.cursorcontrol_cursormanager

Simple interaction user interface interaction for Adafruit_CursorControl. * Author(s): Brent Rubell

class adafruit_cursorcontrol.cursorcontrol_cursormanager.CursorManager(cursor)

Simple interaction user interface interaction for Adafruit_CursorControl.

Parameters:cursor (adafruit_cursorcontrol) – The cursor object we are using.
deinit()

Deinitializes a CursorManager object.

is_clicked

Returns True if the cursor button was pressed during previous call to update()

update()

Updates the cursor object.

class adafruit_cursorcontrol.cursorcontrol_cursormanager.DebouncedCursorManager(cursor, debounce_interval=0.01)

Simple interaction user interface interaction for Adafruit_CursorControl. This subclass provide a debounced version on the A button and provides queries for when the button is just pressed, and just released, as well it’s current state. “Just” in this context means “since the previous call to update.”

Parameters:cursor (adafruit_cursorcontrol) – The cursor object we are using.
held

Returns True if the cursor button is currently being held

is_clicked

Returns True if the cursor button was pressed during previous call to update()

pressed

Returns True if the cursor button was pressed during previous call to update()

released

Returns True if the cursor button was released during previous call to update()

update()

Updates the cursor object.