feat: Widget.ScrollingLabel #46
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ScrollingLabelClassThe
ScrollingLabelclass is a widget for displaying text that automatically scrolls if its length exceeds a specified maximum. It inherits from theLabelclass and adds scrolling functionality with customizable parameters.Key Features:
Parameters:
label: The text to be displayed.max_length: The maximum length of text before scrolling begins (default is 10 characters).scroll_speed: The speed of the scrolling (default is 500 milliseconds).css_classes: A list of CSS classes for styling.justify: The alignment of the text (default is 'left').wrap: Whether to wrap the text (default isTrue).wrap_mode: The text wrapping mode (default is 'word').Important Methods:
_get_display_text: Generates the current text for display, considering scrolling._scroll_text: Updates the scrolling index and updates the displayed text._start_scrolling: Starts a timer to scroll the text._scroll_text_and_continue: Updates the text and continues scrolling.This class is useful for displaying long strings of text, such as news feeds, announcements, etc., where dynamic scrolling of information is needed.