@@ -73,8 +73,11 @@ def __init__(self, display=None, display_group=None, bmp=None, is_hidden=False,
73
73
self ._is_hidden = is_hidden
74
74
self ._display_grp = display_group
75
75
self ._disp_sz = display .height - 1 , display .width - 1
76
+ self ._cur_sprite = None
76
77
if bmp is None :
77
- bmp = self ._default_cursor_bitmap ()
78
+ self ._cursor_bitmap = self ._default_cursor_bitmap ()
79
+ else :
80
+ self ._cursor_bitmap = bmp
78
81
self .generate_cursor (bmp )
79
82
# pylint: enable=too-many-arguments,line-too-long
80
83
@@ -208,6 +211,23 @@ def _default_cursor_bitmap(self):
208
211
return bmp
209
212
#pylint:enable=no-self-use
210
213
214
+ @property
215
+ def cursor_bitmap (self ):
216
+ """Return the cursor bitmap."""
217
+ return self ._cursor_bitmap
218
+
219
+ @cursor_bitmap .setter
220
+ def cursor_bitmap (self , bmp ):
221
+ """Set a new cursor bitmap.
222
+
223
+ :param bmp: A Bitmap to use for the cursor
224
+ """
225
+ self ._cursor_bitmap = bmp
226
+ self ._cursor_grp .remove (self ._cur_sprite )
227
+ self ._cur_sprite = displayio .TileGrid (bmp ,
228
+ pixel_shader = self ._cur_palette )
229
+ self ._cursor_grp .append (self ._cur_sprite )
230
+
211
231
def generate_cursor (self , bmp ):
212
232
"""Generates a cursor icon"""
213
233
self ._is_deinited ()
0 commit comments