Skip to content

Commit b8a30c4

Browse files
authored
Merge pull request #4 from makermelissa/main
Allow user defined cursor image to override hardcoded value
2 parents 7974c0c + 13190b1 commit b8a30c4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adafruit_usb_host_mouse.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
BUTTONS = ["left", "right", "middle"]
4343

4444

45-
def find_and_init_boot_mouse():
45+
def find_and_init_boot_mouse(cursor_image="/launcher_assets/mouse_cursor.bmp"):
4646
"""
4747
Scan for an attached boot mouse connected via USB host.
4848
If one is found initialize an instance of BootMouse class
@@ -87,7 +87,9 @@ def find_and_init_boot_mouse():
8787
mouse_device.set_configuration()
8888

8989
# load the mouse cursor bitmap
90-
mouse_bmp = OnDiskBitmap("/launcher_assets/mouse_cursor.bmp")
90+
if not isinstance(cursor_image, str):
91+
raise TypeError("cursor_image must be a string")
92+
mouse_bmp = OnDiskBitmap(cursor_image)
9193

9294
# make the background pink pixels transparent
9395
mouse_bmp.pixel_shader.make_transparent(0)

0 commit comments

Comments
 (0)