Metadata-Version: 2.4
Name: pyterappeng
Version: 0.2.2
Summary: An ultra-lightweight and simple Python engine designed for building text-based terminal applications with dynamic line buffering and rendering support.
Project-URL: Homepage, https://github.com
Author-email: TheRealPchol <therealpchol7@gmail.com>
License-File: LICENSE
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# 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:

```python
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).
