functui.rich_text

class functui.rich_text.Group(segments: tuple[Segment, ...], is_space: bool)[source]

Represents a connected span of text, like a word or a space.

class functui.rich_text.Justify(*values)[source]

Text Justification.

LEFT
CENTER
RIGHT
class functui.rich_text.Segment(text, rule, length)[source]
length: int

Alias for field number 2

rule: StyleRule

Alias for field number 1

text: str

Alias for field number 0

class functui.rich_text.Span(text: tuple[str | Self, ...], rule: functui.classes.StyleRule)[source]
functui.rich_text.TextWrapFunc

takes in a line. If line is too long it will be wrapped. New line characters have no effect on the outcome

alias of Callable[[Iterable[Segment], int, MeasureTextFunc], Iterable[Iterable[Segment]]]

functui.rich_text.adaptive_text(*string: Span | str, justify=Justify.LEFT, soft_hyphen: str = '-')[source]

A data node for text that can be wrapped and styled.

Parameters:
  • *string – The text content. Parts of content can be wrapped in a span for styling.

  • justify – Text justification.

  • soft_hyphen – Display to signal a word being wrapped between to line.

functui.rich_text.rich_text(*string: Span | str)[source]

A data node for text that can be styled.

Parameters:

*string – The text content. Parts of content can be wrapped in a span for styling.

functui.rich_text.span(*text: str | Span, rule: StyleRule)[source]

Style a text segment in an adaptive_text node.