PyTextCanvas is a module for writing text and ascii art to a 2D string "canvas" in Python.
Project description
# PyTextCanvas PyTextCanvas is a module for writing text and ascii art to a 2D string “canvas” in Python.
PyTextCanvas has a Canvas class, which is a data structure for a “2D string”, where characters can be “drawn” to the canvas using x, y coordinates. The canvas can be exported as a basic Python string or HTML.
Runs on Windows, macOS, and Linux.
This module could be used in curses-like or urwid-like modules.
Installation
pip install pytextcanvas
Example Usage
>>> import pytextcanvas as pytc >>> canvas = pytc.Canvas(20, 4) >>> canvas.fill('.') >>> print(canvas) .................... .................... .................... .................... >>> canvas.write('Hello, world!') >>> print(canvas) Hello, world!....... .................... .................... .................... >>> canvas.cursor = (10, 2) >>> canvas.write('Howdy!!!') >>> print(canvas) Hello, world!....... .................... ..........Howdy!!!.. .................... >>> str(canvas) 'Hello, world!.......\n....................\n..........Howdy!!!..\n....................' >>> canvas.rectangle('*', 0, 0, 20, 4) >>> print(canvas) ******************** *..................* *.........Howdy!!!.* ********************
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
PyTextCanvas-0.0.1.tar.gz
(15.4 kB
view details)
File details
Details for the file PyTextCanvas-0.0.1.tar.gz
.
File metadata
- Download URL: PyTextCanvas-0.0.1.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66f4d3b8b6ef32598b28101c429a9e33ac896f2102f1cff759589dbc1cbce7a3 |
|
MD5 | accb28c6d236aef59e017f0a68263cbb |
|
BLAKE2b-256 | c7a65f578e246e5b3632490c198c0cec61dc8713dc03a2d915660ff2a7f85382 |