TermGFX
A yet another terminal graphics library written in Python.
Why tho?
The idea behind this project is to allow simple yet extensible graphics processing in the terminal. I'm a videogames enjoyer and I have used libraries such as PyGame, so it was an inspiration for me to write my own graphics lib. I decided to use a terminal/TTY as canvas, because I spend a lot of time sitting at it as a Linux user. Moreover, it felt like something a bit more unique (even though there were a bunch of such project already, shh)
What it can
Draw
- Dots
- Lines
- Colors
What's planned
- Cirle shapes
- Arbitrary shapes (with straight sides)
Installation
Prerequisites
In order to use the package, you need Python 3
- Python (3.6+)* (Some examples use 3.10, though)
* 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
Note: you can omit --user, but it's not recommended (see [why][https://stackoverflow.com/questions/42988977/what-is-the-purpose-of-pip-install-user])
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(surface: engine.Canvas) method that allows for easy drawing on a surface
Metadata
Release files for TermGFX 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| TermGFX-0.2.0.tar.gz | 9.5 kB | Without provenance | Details for TermGFX-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| TermGFX-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for TermGFX-0.2.0-py3-none-any.whl |
Total release size: 19.1 kB
Release files / TermGFX-0.2.0.tar.gz
| Download URL | TermGFX-0.2.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e9b8fc5033e4809d8c776c55f4958a2922134a03681c9f4fc79ab9d84639198
|
|
BLAKE2b-256 checksum How to use checksums |
b7ef20189930807d74cf427328e5cf9d3397bd4840c769a63a83bc74131c619c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.4
|
Release files / TermGFX-0.2.0-py3-none-any.whl
| Download URL | TermGFX-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
457166717f70c809607bf22593d889ecfdda293a7ca9b483284ee04a26108a17
|
|
BLAKE2b-256 checksum How to use checksums |
1d477aac3347236faf8c8567efc26533f0664cbed2066d915c5a260683544d89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.4
|
Security for TermGFX 0.2.0
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.