Skip to content

Commit 764d27f

Browse files
committed
Rework hide stuff to make hidden the property and hide/show the control
1 parent 2e9d633 commit 764d27f

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

adafruit_cursorcontrol/cursorcontrol.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ def y(self, y_val):
162162
self._cursor_grp.y = y_val
163163

164164
@property
165-
def hide(self):
165+
def hidden(self):
166166
"""Returns True if the cursor is hidden or visible on the display."""
167167
return self._is_hidden
168168

169-
@hide.setter
170-
def hide(self, is_hidden):
169+
@hidden.setter
170+
def hidden(self, is_hidden):
171171
self._is_deinited()
172172
if is_hidden:
173173
self._is_hidden = True
@@ -176,6 +176,14 @@ def hide(self, is_hidden):
176176
self._is_hidden = False
177177
self._display_grp.append(self._cursor_grp)
178178

179+
def hide(self):
180+
"""Hide the cursor."""
181+
self.hidden = True
182+
183+
def show(self):
184+
"""Show the cursor."""
185+
self.hidden = False
186+
179187
#pylint:disable=no-self-use
180188
def _default_cursor_bitmap(self):
181189
bmp = displayio.Bitmap(20, 20, 3)

examples/cursorcontrol_simpletest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
while True:
2323
cursor.update()
2424
if cursor.is_clicked:
25-
if mouse_cursor.hide:
26-
mouse_cursor.hide = False
25+
if mouse_cursor.hidden:
26+
mouse_cursor.show()
2727
else:
28-
mouse_cursor.hide = True
28+
mouse_cursor.hide()
2929
time.sleep(0.01)

0 commit comments

Comments
 (0)