Skip to content
forked from getcuia/cusser

🤬 A curses wrapper that understands ANSI escape code sequences

License

Notifications You must be signed in to change notification settings

Automattic/cusser

 
 

Repository files navigation

PyPI Python package PyPI - License

Fork 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.

About

🤬 A curses wrapper that understands ANSI escape code sequences

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%