Skip to content

override text property from parent on ScrollingLabel #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions adafruit_display_text/scrolling_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def update(self, force: bool = False) -> None:
if force or self._last_animate_time + self.animate_time <= _now:

if len(self.full_text) <= self.max_characters:
self.text = self.full_text
super()._set_text(self.full_text, self.scale)
self._last_animate_time = _now
return

Expand All @@ -106,8 +106,7 @@ def update(self, force: bool = False) -> None:
_showing_string = "{}{}".format(
_showing_string_start, _showing_string_end
)
self.text = _showing_string

super()._set_text(_showing_string, self.scale)
self.current_index += 1
self._last_animate_time = _now

Expand Down Expand Up @@ -144,3 +143,16 @@ def full_text(self, new_text: str) -> None:
self._full_text = new_text
self.current_index = 0
self.update()

@property
def text(self):
"""The full text to be shown. If it's longer than ``max_characters`` then
scrolling will occur as needed.

:return str: The full text of this label.
"""
return self.full_text

@text.setter
def text(self, new_text):
self.full_text = new_text