Socket
Socket
Sign inDemoInstall

ascii-canvas

Package Overview
Dependencies
0
Maintainers
2
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ascii-canvas

Treat strings like Items on a 2D Canvas.


Maintainers
2

Readme

Version

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|----+
                +-----+

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc