laatikoita/README.md
2025-07-27 00:18:43 +03:00

1.6 KiB

Laatikoita

Laatikoita (Finnish for 'boxes') is a collection of simple one-file libraries for creating and working with "ASCII art" boxes in Python. It implements an interface in the style of Box combinators, but also has support for boxes that have collapsible borders.

Examples

>>> from boxes import from_string as S
>>> S('hello').print()
hello
>>> S('hello').above(S('world')).print()
hello
world
>>> S('hello').above(S('world')).frame().above(S('boxes').frame()).print()
┌─────┐
hello
world
├─────┤
boxes
└─────┘
>>> from layout import stack, lay
>>> stack(map(S, 'split across several lines'.split())).print()
split  
across 
several
lines  
>>> from boxes import box
>>> lay([box(1, 0).frame().to_box(), box(0, 1).frame().to_box()]).print()
┌─┐┌┐
└─┘││
   └┘
>>> from layout import align_bottom
>>> lay([box(1, 0).frame().to_box(), box(0, 1).frame().to_box()], align_bottom).print()
   ┌┐
┌─┐││
└─┘└┘
>>> lay([stack([S('possible to'), S('lay out')]).frame(), S('frames too').frame()]).print()
┌───────────┬──────────┐
possible toframes too
lay out    ├──────────┘
└───────────┘

Documentation

At the moment laatikoita is only really documented using the docstrings.

License

Laatikoita is free software under the terms of Creative Commons Zero 1.0 Universal ("CC0").