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 import canvas
from ascii_canvas import item
canvas_ = canvas.Canvas()
rect_a = item.Item('+-----+\n|Hello|\n+-----+', position=[0, 0])
rect_b = item.Item('+-----+\n|World|\n+-----+', position=[16, 5])
rect_c = item.Item('+-+\n|!|\n+-+', position=[32, 0])
line_a = item.Line(start=[7, 1], end=[15, 6])
line_b = item.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_.render())
Which results in this output:
+-----+ +-+
|Hello|----+ +----|!|
+-----+ | | +-+
| |
| |
| +-----+ |
+----|World|----+
+-----+
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-2.0.0.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for ascii_canvas-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a39b395f8f74279791c6305ebab1f0e909619aab74677f509056dafde33f6e1c |
|
MD5 | 1d64eeaee25d9b3aded57da123695d7a |
|
BLAKE2b-256 | ee1fc2d980a7713e225661daa61ec8b5e75db251e2b3268a5dcb18c80a2ec5d1 |