Skip to content

Commit 85c9a7f

Browse files
author
Margaret Matocha
committed
corrected index replacement of tileGrid, and deletion of unused tileGrids
1 parent bbc0ea9 commit 85c9a7f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

adafruit_display_text/label.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ def _update_text(
232232
i = 1
233233
else:
234234
i = 0
235+
tilegrid_count = i
235236
y_offset = int(
236237
(
237238
self._font.get_glyph(ord("M")).height
@@ -277,14 +278,16 @@ def _update_text(
277278
x=position_x,
278279
y=position_y,
279280
)
280-
if i < len(self):
281-
self[i] = face
281+
if tilegrid_count < len(self):
282+
self[tilegrid_count] = face
282283
else:
283284
self.append(face)
285+
tilegrid_count += 1
284286
x += glyph.shift_x
285287
i += 1
286288
# Remove the rest
287-
while len(self) > i:
289+
290+
while len(self) > tilegrid_count: # i:
288291
self.pop()
289292
self._text = new_text
290293
self._boundingbox = (left, top, left + right, bottom - top)

0 commit comments

Comments
 (0)