Skip to content

Commit ce052ec

Browse files
committed
Tab verification for Bitmap Label
1 parent 2e860cc commit ce052ec

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

adafruit_display_text/bitmap_label.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def __init__(
121121
) # the local_group will always stay in the self Group
122122

123123
self._font = font
124-
self._text = text
124+
self._text = " ".join(text.split("\t"))
125125

126126
# Create the two-color palette
127127
self.palette = displayio.Palette(2)
@@ -204,7 +204,7 @@ def _reset_text(
204204
text = self._text
205205

206206
if self._save_text: # text string will be saved
207-
self._text = text
207+
self._text = " ".join(text.split("\t"))
208208
else:
209209
self._text = None # save a None value since text string is not saved
210210

@@ -239,7 +239,7 @@ def _reset_text(
239239
loose_box_y,
240240
loose_y_offset,
241241
) = self._text_bounding_box(
242-
text,
242+
self._text,
243243
self._font,
244244
self._line_spacing,
245245
) # calculate the box size for a tight and loose backgrounds
@@ -262,7 +262,7 @@ def _reset_text(
262262
# Place the text into the Bitmap
263263
self._place_text(
264264
self.bitmap,
265-
text,
265+
self._text,
266266
self._font,
267267
self._line_spacing,
268268
self._padding_left - x_offset,
@@ -632,6 +632,7 @@ def text(self):
632632

633633
@text.setter # Cannot set color or background color with text setter, use separate setter
634634
def text(self, new_text):
635+
new_text = " ".join(new_text.split("\t"))
635636
self._reset_text(text=new_text, scale=self.scale)
636637

637638
@property

0 commit comments

Comments
 (0)