Skip to main content

Treeart

Treeart lets you draw ASCII trees easily. These can contain nodes that span multiple lines, they will be correctly combined.

Examples

>>> from treeart import *
>>> print(binary_edge(1, 2, 3))
╭─1─╮
2   3

>>> print(binary_edge(1, 2, binary_edge(3, 4, 5)))
╭──1──╮
2   ╭─3─╮
    4   5

>>> x, y = 'x', 'y'
for i in range(5):
    x, y = binary_edge(i, x, y), x
print(x)
                  ╭───────────4───────────╮
          ╭───────3──────╮           ╭────2───╮  
     ╭────2───╮       ╭──1──╮     ╭──1──╮   ╭─0─╮
  ╭──1──╮   ╭─0─╮   ╭─0─╮   x   ╭─0─╮   x   x   y
╭─0─╮   x   x   y   x   y       x   y            
x   y

>>> print(binary_edge('aa\nbb', 'c', 'eee\nfff'))
  aa
╭─bb─╮
c   eee
    fff

Customization

You can specify three kinds of edges, which use more or less space, and might work better for different applications:

>>> print(binary_edge(111, 222, 333, align='upper'))
 ╭─111─╮
222   333

>>> print(binary_edge(111, 222, 333, align='center'))
   111
 ╭──┴──╮
222   333

>>> print(binary_edge(111, 222, 333, align='lower'))
   111
222─┴─333

You can also specify a gap on either side of the abutting edges:

>>> print(binary_edge(111, 222, 333, align='upper', gap=True))
 ╭─ 111 ─╮
222     333

Metadata

Release files for treeart 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for treeart 0.0.2
File Size Uploaded Provenance Actions
treeart-0.0.2.tar.gz 3.1 kB Without provenance Details for treeart-0.0.2.tar.gz

Release files / treeart-0.0.2.tar.gz

Download URL treeart-0.0.2.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4192d640c7b2376bc56ba88cc5e8afd700700490fc184edfef7b9d54abf5854d
BLAKE2b-256 checksum
How to use checksums
60c75462616c6e420dda8ecb727d6ef6047d3306dc34689bc9759bd6617ab8e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.3

Security for treeart 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page