We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 760084b commit 119f638Copy full SHA for 119f638
adafruit_button.py
@@ -192,7 +192,13 @@ def label(self, newtext):
192
self._label = Label(self._label_font, text=newtext)
193
dims = self._label.bounding_box
194
if dims[2] >= self.width or dims[3] >= self.height:
195
- raise RuntimeError("Button not large enough for label")
+ while len(self._label.text) > 1 and (
196
+ dims[2] >= self.width or dims[3] >= self.height
197
+ ):
198
+ self._label.text = "{}.".format(self._label.text[:-2])
199
+ dims = self._label.bounding_box
200
+ if len(self._label.text) <= 1:
201
+ raise RuntimeError("Button not large enough for label")
202
self._label.x = (self.width - dims[2]) // 2
203
self._label.y = self.height // 2
204
self._label.color = self._label_color
0 commit comments