Skip to main content

pyterappeng (Python Terminal Application Engine)

pyterappeng is an ultra-lightweight engine for creating text and terminal applications in Python. It allows you to initialize text buffers dynamically via properties, track terminal window sizes, use ANSI colors, read instant keypresses, and update the screen content.

Features

  • Object-property style line buffering (pyterappeng.line1, pyterappeng.line2)
  • Automatic terminal window size detection (tersizeX, tersizeY)
  • Built-in update cycle with auto-clearing
  • Cross-platform instant keypress handling
  • Built-in ANSI color constants

Installation

Copy the pyterappeng.py file into the root directory of your project.

Usage

The engine works on a buffering principle using dynamically generated properties for each line:

import pyterappeng
from pyterappeng import Colors

pyterappeng.create_lines(3)

while True:
    pyterappeng.line1 = f"{Colors.GREEN}=== MENU (Width: {pyterappeng.tersizeX}, Height: {pyterappeng.tersizeY}) ==={Colors.RESET}"
    pyterappeng.line2 = f"{Colors.CYAN}1. Say Hello{Colors.RESET}"
    pyterappeng.line3 = f"{Colors.RED}2. Exit{Colors.RESET}"
    pyterappeng.update()
    
    key = pyterappeng.get_key()
    
    if key == '1':
        print("Hello World! Press any key to return...")
        pyterappeng.get_key()
    elif key == '2':
        break

API Documentation

create_lines(lines_count: int)

Creates internal properties for storing the lines of your application. Available names range from line1 to line{lines_count}.

line1, line2, ... lineN

Dynamic variables to control the content of each specific row in your application buffer.

tersizeX: int

Contains the current number of characters that fit into a single horizontal row of the terminal window.

tersizeY: int

Contains the current total number of visible rows available in the terminal window.

update(clear: bool = True)

Prints all active lines (line1, line2, etc.) to the console. Clears the screen before rendering by default.

get_key() -> str

Reads a single keypress from the user instantly without waiting for the Enter key. Works on Windows, Linux, and macOS.

Colors

A class containing ANSI escape codes for text styling: RESET, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, and BOLD.

Roadmap

  • Real-time update of tersizeX and tersizeY upon window resize events
  • Implement custom UI components (text inputs, checkboxes)

License

This project is licensed under the GNU General Public License (GPL).

Metadata

Release files for pyterappeng 0.2.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 pyterappeng 0.2.2
File Size Uploaded Provenance Actions
pyterappeng-0.2.2.tar.gz 14.6 kB Without provenance Details for pyterappeng-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyterappeng 0.2.2
File Interpreter ABI Platform Actions
pyterappeng-0.2.2-py3-none-any.whl Python 3 none any Details for pyterappeng-0.2.2-py3-none-any.whl

Total release size: 30.2 kB

Release files / pyterappeng-0.2.2.tar.gz

Download URL pyterappeng-0.2.2.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7fa826e157d3f44017c35de33416c2734fe6943e42817ce78908c35393548d1c
BLAKE2b-256 checksum
How to use checksums
b78a1b178a71e8b1dc94ffcee30c17052d81de20ce667f4f74aa7b40a8e4a083
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Release files / pyterappeng-0.2.2-py3-none-any.whl

Download URL pyterappeng-0.2.2-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90368b39e5de45c52e5f93702e4dfc539a31c2e7f94f06fdf032fef970b69cdf
BLAKE2b-256 checksum
How to use checksums
7c695490972eebd8e4d114c24a2760d92ab04bb2548292b0fa2fde6f598152ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Security for pyterappeng 0.2.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.

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