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.1.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file ascii_canvas-2.0.1.tar.gz
.
File metadata
- Download URL: ascii_canvas-2.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.7.17 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 588e9fbac4d3a23d0238222c9c932b7a7d4b75363d3f69b61cb7660665be76c0 |
|
MD5 | 7b03ce01c911fa5358a5ec9671bd9660 |
|
BLAKE2b-256 | deb44f88ccd324bc143605f4223e8133c9888485aeb64e53506d6251c4387403 |
File details
Details for the file ascii_canvas-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: ascii_canvas-2.0.1-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.7.17 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a23547aeb3f218b3ab7c323ff82e1afccafa87e6c2e509eecb522830bf1fbbb |
|
MD5 | 8b5d0ffed0125adec313e2419c71b81d |
|
BLAKE2b-256 | c031cb3b2ad8e2583ad8d5d0d2231c59a0412a36c835fe84b721ecbaa3fecdec |