File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ import time
2
+ import board
3
+ import displayio
4
+ from adafruit_cursorcontrol .cursorcontrol import Cursor
5
+ from adafruit_cursorcontrol .cursorcontrol_cursormanager import CursorManager
6
+
7
+ # Create the display
8
+ display = board .DISPLAY
9
+
10
+ # Create the display context
11
+ splash = displayio .Group (max_size = 5 )
12
+
13
+ # initialize the mouse cursor object
14
+ bmp = displayio .Bitmap (20 , 20 , 3 )
15
+ for i in range (0 , bmp .height ):
16
+ bmp [0 , i ] = 1
17
+ bmp [bmp .width - 1 , i ] = 1
18
+ for i in range (0 , bmp .width ):
19
+ bmp [i , 0 ] = 1
20
+ bmp [i , bmp .height - 1 ] = 1
21
+
22
+ mouse_cursor = Cursor (display , display_group = splash , bmp = bmp )
23
+
24
+ # initialize the cursormanager
25
+ cursor = CursorManager (mouse_cursor )
26
+
27
+ # show displayio group
28
+ display .show (splash )
29
+
30
+ while True :
31
+ cursor .update ()
32
+ if cursor .is_clicked :
33
+ if mouse_cursor .hidden :
34
+ mouse_cursor .show ()
35
+ else :
36
+ mouse_cursor .hide ()
37
+ time .sleep (0.01 )
You can’t perform that action at this time.
0 commit comments