diff --git a/adafruit_pyoa.py b/adafruit_pyoa.py index f3d967e..a97c24e 100644 --- a/adafruit_pyoa.py +++ b/adafruit_pyoa.py @@ -90,6 +90,7 @@ def __init__(self): self.backlight_fade(0) board.DISPLAY.show(self.root_group) self.touchscreen = None + self.mouse_cursor = None if hasattr(board, 'TOUCH_XL'): self.touchscreen = adafruit_touchscreen.Touchscreen(board.TOUCH_XL, board.TOUCH_XR, board.TOUCH_YD, board.TOUCH_YU, @@ -152,14 +153,16 @@ def load_game(self, game_directory): def _fade_to_black(self): """Turn down the lights.""" - self.mouse_cursor.is_hidden = True + if self.mouse_cursor: + self.mouse_cursor.is_hidden = True self.backlight_fade(0) # turn off background so we can render the text self.set_background(None, with_fade=False) self.set_text(None, None) for _ in range(len(self._button_group)): self._button_group.pop() - self.mouse_cursor.is_hidden = False + if self.mouse_cursor: + self.mouse_cursor.is_hidden = False def _display_buttons(self, card): """Display the buttons of a card.