Skip to content

corrected index replacement of tileGrid, and deletion of unused tileGrids #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions adafruit_display_text/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def _update_text(
i = 1
else:
i = 0
tilegrid_count = i
y_offset = int(
(
self._font.get_glyph(ord("M")).height
Expand Down Expand Up @@ -277,14 +278,16 @@ def _update_text(
x=position_x,
y=position_y,
)
if i < len(self):
self[i] = face
if tilegrid_count < len(self):
self[tilegrid_count] = face
else:
self.append(face)
tilegrid_count += 1
x += glyph.shift_x
i += 1
# Remove the rest
while len(self) > i:

while len(self) > tilegrid_count: # i:
self.pop()
self._text = new_text
self._boundingbox = (left, top, left + right, bottom - top)
Expand Down