Terminal graphics with zero deps
Project description
TermGFX
A yet another terminal graphics written in Python.
What it can
Draw
- Dots
- Lines (poorly, for now)
What's planned
- Adequate Line drawing
- Cirle shapes
- Arbitrary shapes (with straight sides)
Installation
Prerequisites
In order to use the package, you need Python 3
- Python (3.6+)*
* If incorrect, please report (too lazy to figure out actual range of versions needed)
pip
You can use pip or pip3 to install TermGFX by executing
pip --user install termgfx
From source
The source code is located in <project root>/src/TermGFX/, so, in order to use it, you might just copy the file onto yout project directory, though it's not recommended (pip is a better option)
Usage
To get more information on project usage, you can view examples located in <project root>/examples/
Here's an overview:
First, import the Canvas
from TermGFX.engine import Canvas
Then, create a Canvas instance
window_size = (20, 10) # Size of the canvas
canvas = Canvas(window_size) # Instantiate a canvas with the size of (20, 10)
Pixels
Now you can set "pixels" on the canvas
char = "O" # A character to be displayed
canvas.set((0, 0), char) # Set (0, 0) pixel to "O"
And draw the canvas on the "screen"
canvas.draw()
Shapes
For all shapes, see shapes.py
Example: Drawing a rectangle filled with "$" chars:
from TermGFX.engine import Canvas
from TermGFX.shapes import FilledRect
canvas = Canvas((20, 10))
rect = FilledRect((5, 2), "$")
rect.draw(canvas)
canvas.draw()
Tip: shapes usually have a draw method that allows for easy drawing on a surface
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file TermGFX-0.0.1.tar.gz.
File metadata
- Download URL: TermGFX-0.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d19a4f5c3bbe28494d82d20a9f152d16b2dfd6aed63f38fe8ecad36ea4d840e
|
|
| MD5 |
15505c2eab4a33770a1d3f43d0acdd49
|
|
| BLAKE2b-256 |
a69a51b888ac46d9a67098654593b58db80c5bfe93cdfb732aeee4d2d0d66f08
|
File details
Details for the file TermGFX-0.0.1-py3-none-any.whl.
File metadata
- Download URL: TermGFX-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ee43cff7f817637662dc11750e539a82b098f6872b87ac2843073d1c8e05b44
|
|
| MD5 |
934c152dfc72c3b54cda30bb96822dce
|
|
| BLAKE2b-256 |
01c9f2814390defb4064d271249cf42c3bc5106a28f086f6dac0df580dc726b4
|