Skip to content

Commit 635ad4e

Browse files
Merge pull request #188 from FoamyGuy/scrolling_label_text_prop
override text property from parent on ScrollingLabel
2 parents 81998a6 + 4436be5 commit 635ad4e

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

adafruit_display_text/scrolling_label.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def update(self, force: bool = False) -> None:
8686
if force or self._last_animate_time + self.animate_time <= _now:
8787

8888
if len(self.full_text) <= self.max_characters:
89-
self.text = self.full_text
89+
super()._set_text(self.full_text, self.scale)
9090
self._last_animate_time = _now
9191
return
9292

@@ -106,8 +106,7 @@ def update(self, force: bool = False) -> None:
106106
_showing_string = "{}{}".format(
107107
_showing_string_start, _showing_string_end
108108
)
109-
self.text = _showing_string
110-
109+
super()._set_text(_showing_string, self.scale)
111110
self.current_index += 1
112111
self._last_animate_time = _now
113112

@@ -144,3 +143,16 @@ def full_text(self, new_text: str) -> None:
144143
self._full_text = new_text
145144
self.current_index = 0
146145
self.update()
146+
147+
@property
148+
def text(self):
149+
"""The full text to be shown. If it's longer than ``max_characters`` then
150+
scrolling will occur as needed.
151+
152+
:return str: The full text of this label.
153+
"""
154+
return self.full_text
155+
156+
@text.setter
157+
def text(self, new_text):
158+
self.full_text = new_text

0 commit comments

Comments
 (0)