From 044c03acbf34fe17f6f2691250ea2351a1682249 Mon Sep 17 00:00:00 2001 From: ch4nsuk3 <134003603+ch4nsuk3@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:53:21 -0600 Subject: [PATCH] Exposed Name attribute The name attribute is not a property that can be read or set. --- adafruit_button/button_base.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/adafruit_button/button_base.py b/adafruit_button/button_base.py index 8a7709c..c8cc35d 100644 --- a/adafruit_button/button_base.py +++ b/adafruit_button/button_base.py @@ -68,7 +68,7 @@ def __init__( self._height = height self._font = label_font self._selected = False - self.name = name + self._name = name self._label = label self._label_color = label_color self._label_font = label_font @@ -157,3 +157,12 @@ def label_color(self): def label_color(self, new_color): self._label_color = _check_color(new_color) self._label.color = self._label_color + + @property + def name(self) -> str: + """The name of the button""" + return self._name + + @name.setter + def name(self, new_name: str) -> None: + self._name = new_name