Skip to content

Commit 044c03a

Browse files
committed
Exposed Name attribute
The name attribute is not a property that can be read or set.
1 parent 9d18dcd commit 044c03a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

adafruit_button/button_base.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(
6868
self._height = height
6969
self._font = label_font
7070
self._selected = False
71-
self.name = name
71+
self._name = name
7272
self._label = label
7373
self._label_color = label_color
7474
self._label_font = label_font
@@ -157,3 +157,12 @@ def label_color(self):
157157
def label_color(self, new_color):
158158
self._label_color = _check_color(new_color)
159159
self._label.color = self._label_color
160+
161+
@property
162+
def name(self) -> str:
163+
"""The name of the button"""
164+
return self._name
165+
166+
@name.setter
167+
def name(self, new_name: str) -> None:
168+
self._name = new_name

0 commit comments

Comments
 (0)