Skip to content

Commit 969fe01

Browse files
authored
Merge pull request #232 from FoamyGuy/text_box_fix_tilegrid_prop
fix TextBox.text setter & Add tilegrid property to BitmapLabel
2 parents d2e3820 + 1c32544 commit 969fe01

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

adafruit_display_text/bitmap_label.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,3 +1057,10 @@ def text(self):
10571057
def text(self, new_text):
10581058
self.full_text = new_text
10591059
self.update(True)
1060+
1061+
@property
1062+
def tilegrid(self) -> displayio.TileGrid:
1063+
"""
1064+
The TileGrid that contains the Bitmap for this Label.
1065+
"""
1066+
return self._tilegrid

adafruit_display_text/text_box.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,11 @@ def text(self, text: str) -> None:
383383
self.lines = wrap_text_to_pixels(
384384
text, self._width - self._padding_left - self._padding_right, self.font
385385
)
386-
self._text = self._replace_tabs(text)
387-
self._original_text = self._text
388-
self._text = "\n".join(self.lines)
386+
self._full_text = self._replace_tabs(text)
387+
self._original_text = self._full_text
388+
self._full_text = "\n".join(self.lines)
389389

390-
self._set_text(self._text, self.scale)
390+
self._set_text(self._full_text, self.scale)
391391

392392
@property
393393
def align(self):

0 commit comments

Comments
 (0)