Skip to content

Commit 8dd5641

Browse files
author
brentru
committed
set a mouse_cursor attribute, check attribute before hiding
1 parent fb48d6c commit 8dd5641

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

adafruit_pyoa.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def __init__(self):
9696
self.backlight_fade(0)
9797
board.DISPLAY.show(self.root_group)
9898
self.touchscreen = None
99+
self.mouse_cursor = None
99100
if hasattr(board, 'TOUCH_XL'):
100101
self.touchscreen = adafruit_touchscreen.Touchscreen(board.TOUCH_XL, board.TOUCH_XR,
101102
board.TOUCH_YD, board.TOUCH_YU,
@@ -158,14 +159,16 @@ def load_game(self, game_directory):
158159

159160
def _fade_to_black(self):
160161
"""Turn down the lights."""
161-
self.mouse_cursor.is_hidden = True
162+
if self.mouse_cursor:
163+
self.mouse_cursor.is_hidden = True
162164
self.backlight_fade(0)
163165
# turn off background so we can render the text
164166
self.set_background(None, with_fade=False)
165167
self.set_text(None, None)
166168
for _ in range(len(self._button_group)):
167169
self._button_group.pop()
168-
self.mouse_cursor.is_hidden = False
170+
if self.mouse_cursor:
171+
self.mouse_cursor.is_hidden = False
169172

170173
def _display_buttons(self, card):
171174
"""Display the buttons of a card.

0 commit comments

Comments
 (0)