str2d.Box

Box(spec_v: ~typing.List[int] | None = None, spec_h: ~typing.List[int] | None = None, style: ~str2d.BoxStyle | str = SINGLE
class str2d.BoxROUND
Box╭─┬─╮
Box│
Box├─┼─┤
Box│
Box╰─┴─╯ )

Subclass of Str2D that is a Box or Window. I wanted to be able to make window pains with arbitrary number of rows and columns.

I had to override the transformation methods i, t, h, v, and r because I wanted to preserve the box characters orientation.

Parameters:
  • spec_v (List[int], optional) – The vertical specification, by default None. This is a list of integers that represent the height of the rows.

  • spec_h (List[int], optional) – The horizontal specification, by default None. This is a list of integers that represent the width of the columns.

  • style (Union[BoxStyle, str], optional) – The style of the box, by default BoxStyle.SINGLE_ROUND.

Examples

Let’s create a box with a single round style.

from str2d import Box

Box(spec_v=[1, 2, 3], spec_h=[1, 2, 3])
╭─┬──┬───╮
│ │  │   │
├─┼──┼───┤
│ │  │   │
│ │  │   │
├─┼──┼───┤
│ │  │   │
│ │  │   │
│ │  │   │
╰─┴──┴───╯