Skip to main content

A curses wrapper that understands ANSI escape code sequences

Project description

PyPI Python package PyPI - License

For of cusser with added support of Python 3.11+

cusser 🤬

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

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)

Screenshot

Credits

Photo by Gwendal Cottin on Unsplash.

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

a8c_cusser-0.2.0.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.

a8c_cusser-0.2.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file a8c_cusser-0.2.0.tar.gz.

File metadata

  • Download URL: a8c_cusser-0.2.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for a8c_cusser-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7eaa1e5a2fb3d267a634d3ddcb81c951a778b3f1e6c3a84c3ebb0899e405dccd
MD5 8fd50a2bd96c99cd5d686ba52ac708ca
BLAKE2b-256 cc09a91d60871c7f1f4bc9669f546b617d8cbb128570c5a447a2febeb55bf83d

See more details on using hashes here.

File details

Details for the file a8c_cusser-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: a8c_cusser-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for a8c_cusser-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbb592367be8065b729b23126728c3d6398f5abf05162324b42a1be29498cb9b
MD5 523a87ad957080c6f77b741181b03acf
BLAKE2b-256 a9612e323f04756bf22595849204e70fa405c9971bac845e094844d18b294ec2

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