Treat strings like Items on a 2D Canvas.
Project description
Treat strings like Items on a 2D Canvas
With this primitive library you can do things like this:
from ascii_canvas.canvas import Canvas
from ascii_canvas.item import Item, Line
canvas = Canvas()
rect_a = Item('+-----+\n|Hello|\n+-----+', position=[0, 0])
rect_b = Item('+-----+\n|World|\n+-----+', position=[16, 5])
rect_c = Item('+-+\n|!|\n+-+', position=[32, 0])
line_a = Line(start=[7, 1], end=[15, 6])
line_b = Line(start=[23, 6], end=[31, 1])
canvas.add_item(rect_a)
canvas.add_item(rect_b)
canvas.add_item(rect_c)
canvas.add_item(line_a)
canvas.add_item(line_b)
print(canvas.draw())
Which results in this output:
0+-----+ +-+
1|Hello|----+ +----|!|
2+-----+ | | +-+
3 | |
4 | |
5 | +-----+ |
6 +----|World|----+
7 +-----+
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ascii-canvas-1.2.3.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for ascii_canvas-1.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e9535ee34febfce46ebf68458f95e43c88156543f7b7b4d565c018f05c0dc67 |
|
MD5 | 0b4b7ec8391dd8f00f5a0631f1c96d84 |
|
BLAKE2b-256 | 246a9ea0cee448edf0cf8d431d64a74ac68ab75623ee52b131cef7bfc57e2ee8 |