str2d.Str2D.show_with_alignment

Str2D.show_with_alignment(expand=2, box=True) Str2D[source]

Show the alignment parameters with object. This is useful for debugging and understanding how the alignment parameters affect the output.

Parameters:
  • expand (int, optional) – The amount to expand the Str2D object, by default 2.

  • box (bool, optional) – Whether to box the Str2D object, by default True.

Returns:

A new Str2D object with the alignment parameters displayed as text.

Return type:

Str2D

Examples

Let’s create an instance of Str2D and assign it to the variable a.

from str2d import Str2D

a = Str2D('a b c d\ne f g\nh i\nj')

We can show the alignment parameters as part of a new Str2D object.

a.show_with_alignment()
╭─────────╮
│a b c d  │
│e f g    │
│h i      │
│j        │
│         │
│         │
╰─────────╯
-----------
v: top
h: left