Skip to content

Commit de3276c

Browse files
authored
Merge pull request #168 from Neradoc/patch-1
Free the bitmap when set to empty string
2 parents a49295f + 79561c4 commit de3276c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

adafruit_display_text/bitmap_label.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ def _reset_text(
154154
for _ in self._local_group:
155155
self._local_group.pop(0)
156156

157+
# Free the bitmap and tilegrid since they are removed
158+
self._bitmap = None
159+
self._tilegrid = None
160+
157161
else: # The text string is not empty, so create the Bitmap and TileGrid and
158162
# append to the self Group
159163

@@ -200,9 +204,7 @@ def _reset_text(
200204
# Place the text into the Bitmap
201205
self._place_text(
202206
self._bitmap,
203-
text
204-
if self._label_direction != "RTL"
205-
else "".join(reversed(self._text)),
207+
text if self._label_direction != "RTL" else "".join(reversed(text)),
206208
self._font,
207209
self._padding_left - x_offset,
208210
self._padding_top + y_offset,

0 commit comments

Comments
 (0)