xnano.demo
xnano.demo
¶
xnano.demo
The feature demo: python -m xnano. It opens with an animation, then fills the window with
live panels that each use a different part of xnano. It is written with the public API only,
so it doubles as a larger example.
Functions:
-
main–Run the demo in the whole window.
edge
¶
edge(fraction: float) -> NumericValue[int | float]
row
¶
row(fraction: float) -> NumericValue[int | float]
wordmark
¶
wordmark() -> Buffer
The xnano block letters, with see-through gaps so the animation shows between them.
Source code in xnano/demo.py
def wordmark() -> Buffer:
"""The ``xnano`` block letters, with see-through gaps so the animation shows between them."""
buffer = Buffer(width=max(len(line) for line in WORDMARK), height=len(WORDMARK))
for y, line in enumerate(WORDMARK):
for x in range(buffer.width):
character = line[x] if x < len(line) else ' '
if character == ' ':
buffer[x, y] = Cell(' ', is_transparent=True)
else:
buffer[x, y] = Cell(character, style=Style(INK, bold=True))
return buffer