Skip to content

Commit

Permalink
Merge pull request #168 from Neradoc/patch-1
Browse files Browse the repository at this point in the history
Free the bitmap when set to empty string
  • Loading branch information
dhalbert committed Apr 2, 2022
2 parents a49295f + 79561c4 commit de3276c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions adafruit_display_text/bitmap_label.py
Expand Up @@ -154,6 +154,10 @@ def _reset_text(
for _ in self._local_group:
self._local_group.pop(0)

# Free the bitmap and tilegrid since they are removed
self._bitmap = None
self._tilegrid = None

else: # The text string is not empty, so create the Bitmap and TileGrid and
# append to the self Group

Expand Down Expand Up @@ -200,9 +204,7 @@ def _reset_text(
# Place the text into the Bitmap
self._place_text(
self._bitmap,
text
if self._label_direction != "RTL"
else "".join(reversed(self._text)),
text if self._label_direction != "RTL" else "".join(reversed(text)),
self._font,
self._padding_left - x_offset,
self._padding_top + y_offset,
Expand Down

0 comments on commit de3276c

Please sign in to comment.