Skip to content

Commit be8f3b2

Browse files
committed
Simplified to just use scale property of label
1 parent 79d0c47 commit be8f3b2

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

adafruit_matrixportal/matrixportal.py

+7-15
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,7 @@ def set_text_color(self, color, index=0):
250250
if self._text[index]:
251251
color = self.html_color_convert(color)
252252
self._text_color[index] = color
253-
if isinstance(self._text[index], Group):
254-
self._text[index][0].color = color
255-
else:
256-
self._text[index].color = color
253+
self._text[index].color = color
257254

258255
def set_text(self, val, index=0):
259256
"""Display text, with indexing into our list of text boxes.
@@ -273,17 +270,12 @@ def set_text(self, val, index=0):
273270
if self._text[index] is not None:
274271
print("Replacing text area with :", string)
275272
if len(string) > 0:
276-
label = Label(self._text_font, text=string)
277-
label.color = self._text_color[index]
278-
if self._text_scale[index] > 1:
279-
self._text[index] = Group(max_size=1, scale=self._text_scale[index])
280-
self._text[index].x = self._text_position[index][0]
281-
self._text[index].y = self._text_position[index][1]
282-
self._text[index].append(label)
283-
else:
284-
label.x = self._text_position[index][0]
285-
label.y = self._text_position[index][1]
286-
self._text[index] = label
273+
self._text[index] = Label(
274+
self._text_font, text=string, scale=self._text_scale[index]
275+
)
276+
self._text[index].color = self._text_color[index]
277+
self._text[index].x = self._text_position[index][0]
278+
self._text[index].y = self._text_position[index][1]
287279
elif index_in_splash is not None:
288280
self._text[index] = None
289281

0 commit comments

Comments
 (0)