TextSpan
A text span.
Usage Example: As a child of flet.Text.spans.
For the object to be useful, at least one of text or spans should be set.
Inherits: Control
Properties
semantics_label- An alternative semantics label for this text.spans- Additional spans to include as children.spell_out- Whether the assistive technologies should spell out this text character by character.style- Defines the style of this text span.text- The text contained in this span.url- The URL to open when this button is clicked.
Events
Properties
semantics_labelclass-attributeinstance-attribute
semantics_label: Optional[str] = NoneAn alternative semantics label for this text.
If present, the semantics of this control will contain this value instead of the actual text.
Raises:
- ValueError - If it is set when text is
None.
spansclass-attributeinstance-attribute
spans: Optional[list[TextSpan]] = NoneAdditional spans to include as children.
If both spans and text are defined,
the text takes precedence.
spell_outclass-attributeinstance-attribute
spell_out: Optional[bool] = NoneWhether the assistive technologies should spell out this text character by character.
If the text is 'hello world', setting this to true causes the assistive technologies, such as VoiceOver or TalkBack, to pronounce 'h-e-l-l-o-space-w-o-r-l-d' instead of complete words. This is useful for texts, such as passwords or verification codes.
If this span contains other text span children, they also inherit the property from this span unless explicitly set.
If the property is not set, this text span inherits the spell out setting from its parent. If this text span does not have a parent or the parent does not have a spell out setting, this text span does not spell out the text by default.
styleclass-attributeinstance-attribute
style: Optional[TextStyle] = NoneDefines the style of this text span.
Events
on_clickclass-attributeinstance-attribute
on_click: Optional[ControlEventHandler[TextSpan]] = NoneCalled when this span is clicked.
on_enterclass-attributeinstance-attribute
on_enter: Optional[ControlEventHandler[TextSpan]] = NoneCalled when a mouse pointer has entered this span.
on_exitclass-attributeinstance-attribute
on_exit: Optional[ControlEventHandler[TextSpan]] = NoneCalled when a mouse pointer has exited this span.