Rework hide stuff to make hidden the property and hide/show the control
This commit is contained in:
parent
2e9d633cdc
commit
764d27f8a6
2 changed files with 14 additions and 6 deletions
|
|
@ -162,12 +162,12 @@ class Cursor(object):
|
|||
self._cursor_grp.y = y_val
|
||||
|
||||
@property
|
||||
def hide(self):
|
||||
def hidden(self):
|
||||
"""Returns True if the cursor is hidden or visible on the display."""
|
||||
return self._is_hidden
|
||||
|
||||
@hide.setter
|
||||
def hide(self, is_hidden):
|
||||
@hidden.setter
|
||||
def hidden(self, is_hidden):
|
||||
self._is_deinited()
|
||||
if is_hidden:
|
||||
self._is_hidden = True
|
||||
|
|
@ -176,6 +176,14 @@ class Cursor(object):
|
|||
self._is_hidden = False
|
||||
self._display_grp.append(self._cursor_grp)
|
||||
|
||||
def hide(self):
|
||||
"""Hide the cursor."""
|
||||
self.hidden = True
|
||||
|
||||
def show(self):
|
||||
"""Show the cursor."""
|
||||
self.hidden = False
|
||||
|
||||
#pylint:disable=no-self-use
|
||||
def _default_cursor_bitmap(self):
|
||||
bmp = displayio.Bitmap(20, 20, 3)
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ display.show(splash)
|
|||
while True:
|
||||
cursor.update()
|
||||
if cursor.is_clicked:
|
||||
if mouse_cursor.hide:
|
||||
mouse_cursor.hide = False
|
||||
if mouse_cursor.hidden:
|
||||
mouse_cursor.show()
|
||||
else:
|
||||
mouse_cursor.hide = True
|
||||
mouse_cursor.hide()
|
||||
time.sleep(0.01)
|
||||
|
|
|
|||
Loading…
Reference in a new issue