Metadata-Version: 2.4
Name: PyTermint
Version: 0.0.2
Summary: A terminal interface that abstracts it into a tilemap with 3 bit rgb support for charecter fore/background.
Project-URL: Homepage, https://github.com/Antlar256/PyTerm
Project-URL: Issues, https://github.com/Antlar256/PyTerm/issues
Author-email: Antlar256 <antonio0granell2@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# PyTerm
This is a cross-platform terminal abstraction that converts a tile map to a non-flickering terminal output with 3 bit rgb support using escape codes. It also has significant amounts of input automation for things like typing and movement. It clocks in at around 26.5k bytes (k is 1024) and has no significant dependencies outside of the [***Python Standard Library***](https://docs.python.org/3/library/index.html) (*other than evdev for linux input but it handles the lack of this automatically*).
***
* **Install with "*pip install PyTermint*"** 
* **Import as "*import PyTerm*"**
* **Create a *init()* function that takes *screen* and returns the inital state of the tile map (*a list of lists addresable as arr[y][x] or [y0 [x0, x1, x2...], y1 [x0, x1, x2...]...]*), a dictionary holding all variables that should persist after the end of a frame and a optional command string**
* **Create a *tick()* command that takes as inputs *tick(screen, vars, keys)*. Screen is an array, vars is the dict you initialized in *init* and keys which is a set of every key thats pressed**
* **Call the *run(tick_func, init_func)***
***
```i
mport PyTerm as pt
from PyTerm import clear, blit, color, TILE_SET, HEIGHT, WIDTH, pressed

def init(screen):
    return (screen, {
        'text': '', 
        'cpos': (0, 0),  
    })

def tick(screen, v, keys):
    pt.clear(screen, pt.color(0, bg=1)) 
    pt.handle_input(v, keys)
    if "alt" in keys and "q" in keys: return "quit"
    pt.blit(screen, pt.str_to_arr(v["text"], pt.color(0)), 0, 0)
    # Cursor rendering
    x, y = v['cpos']
    if pt.inside(screen, (x, y)):
        screen[y][x] = pt.color(8, fg=1, bg=2)

if __name__ == "__main__":
    pt.run(tick, init, False)
```
* ***A small text editor for PyTerm***

***
[GitHub Home page link](https://github.com/Antlar256/PyTerm)