Skip to main content

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

TermGFX-0.0.2.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

TermGFX-0.0.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file TermGFX-0.0.2.tar.gz.

File metadata

  • Download URL: TermGFX-0.0.2.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.3

File hashes

Hashes for TermGFX-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2abc25a83477ed0b2c3552667d5746453c290876ac0e94e5c3027a59c7f39856
MD5 43356b88086560b5da1f2097dc92cc24
BLAKE2b-256 214acefbd29770c0b9b7e11dad92c3da6265c939a0d31fbce9a761feedacaa63

See more details on using hashes here.

File details

Details for the file TermGFX-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: TermGFX-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.3

File hashes

Hashes for TermGFX-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 298ca437bd0ee17ed4bcadd5827647974750b78fd4f358afbf756d38727773d0
MD5 518df431de88598bdb6cbca5335031d9
BLAKE2b-256 8be3aee65f61f126e95b12a13df38f2e0415dba1ca99b945542deda5c23683d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page