A curses wrapper that understands ANSI escape code sequences
Project description
For of cusser with added support of Python 3.11+
cusser 🤬
A curses wrapper that understands ANSI escape code sequences
cusser is a lightweight Python package for teaching curses how to use ANSI escape code sequences. It works by wrapping the curses standard window object and intercepting escape code sequences.
Features
- ♻️ Easily integrate with the
standard
curses
module - 🕹️ Use the same escape code sequences as you would with Colorama
- 🖍️ Only one dependency: stransi (for actuallly parsing escape code sequences)
- 🐍 Python 3.8+
Installation
$ pip install cusser
Usage
In[1]:
import curses
In[2]:
from a8c_cusser import Cusser
In[3]:
def app(stdscr) -> None:
...: """Start a new application."""
...:
if not isinstance(stdscr, Cusser):
...: stdscr = Cusser(stdscr)
...:
...: ultra_violet = (100, 83, 148)
...: x, y = 34, 12
...: stdscr.addstr(
...: f"\033[2J\033[{x};{y}H"
...: "\033[1;32mHello "
...: f"\033[;3;38;2;{';'.join(map(str, ultra_violet))}m"
...: "cusser"
...: "\033[m 🤬!"
...: )
...: stdscr.refresh()
...: stdscr.getch()
...:
In[4]: curses.wrapper(app)
Credits
Photo by Gwendal Cottin on Unsplash.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
a8c_cusser-0.2.0.tar.gz
(6.8 kB
view hashes)
Built Distribution
Close
Hashes for a8c_cusser-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbb592367be8065b729b23126728c3d6398f5abf05162324b42a1be29498cb9b |
|
MD5 | 523a87ad957080c6f77b741181b03acf |
|
BLAKE2b-256 | a9612e323f04756bf22595849204e70fa405c9971bac845e094844d18b294ec2 |