Skip to content

Commit 034026e

Browse files
brentrubrentru
brentru
authored and
brentru
committed
remove dispio dep, display object is passed in, add code example
1 parent 7539464 commit 034026e

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

adafruit_cursor.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
`adafruit_cursor`
2424
================================================================================
2525
26-
Simulated mouse cursor for interaction using displayio Groups.
26+
Mouse cursor for interaction with displayio Groups.
2727
2828
* Author(s): Brent Rubell
2929
@@ -37,19 +37,31 @@
3737
* Adafruit CircuitPython firmware for the supported boards:
3838
https://github.com/adafruit/circuitpython/releases
3939
"""
40-
import displayio
4140

4241
__version__ = "0.0.0-auto.0"
4342
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Cursor.git"
4443

4544
class Cursor:
46-
"""Mouse cursor-like interaction for CircuitPython.
45+
"""Mouse cursor interaction for CircuitPython.
4746
4847
:param displayio.Display: CircuitPython display object.
4948
:param displayio.Group: CircuitPython group object to append the cursor to.
5049
:param int cursor_speed: Speed of the cursor, in pixels.
5150
;param int scale: Scale amount for the cursor in both directions.
5251
:param bool is_hidden: Cursor is hidden on init.
52+
53+
Example for creating a cursor layer:
54+
.. code-block:: python
55+
import adafruit_cursor
56+
# Create the display
57+
display = board.DISPLAY
58+
59+
# Create the display context
60+
splash = displayio.Group(max_size=22)
61+
62+
# initialize the mouse cursor object
63+
mouse_cursor = adafruit_cursor.Cursor(display, display_group=splash)
64+
5365
"""
5466
# pylint: disable=too-many-arguments
5567
def __init__(self, display=None, display_group=None, is_hidden=False, cursor_speed=5, scale=1):

0 commit comments

Comments
 (0)