Skip to main content

Library for TUI programs on basis of curses

Project description

cursedspace

A python library/framework for TUI application on the basis of the curses package.

Example use

Here’s a very simple example of how to use the cursedspace package:

#!/usr/bin/env python3

import curses
from cursedspace import Application, Key, Panel, colors


class DemoApplication(Application):
    def __init__(self):
        super().__init__()
        self.panel = None

    def main(self):
        self.panel = Panel(self)
        self.resize()

        self.screen.addstr(0, 0, "Just some color example", colors.attr(colors.RED))

        while True:
            curses.doupdate()

            key = self.read_key()

            if key == Key.RESIZE:
                self.resize()
            elif key in [Key.ESCAPE, "q", "^C"]:
                break

    def resize(self):
        height, width = self.size()
        self.panel.resize(height, width)
        self.panel.paint()


# run the application
DemoApplication().run()

For more examples see the examples folder.

Components

  • Application is the main application class and provides boilerplate initialisations
  • Panel is a basic panel with support for borders and key handling in the context of an Application
  • InputLine is a panel with very basic editing support.
  • Key provides a convenient wrapper around curses’ key system. It can be used standalone even when you don’t want to use Application or Panel.
  • ShellContext is a convenient wrapper to execute external processes (e.g. through subprocess) and returning to the curses context afterwards again.
  • colors is a generic way to define colors in pairs (foreground and background) and have them automatically registerd for use in curses. You only have to call colors.attr(ColorPair(...)) to use a new color combination (limited by the terminal, of course).

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

cursedspace-1.5.0.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cursedspace-1.5.0-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file cursedspace-1.5.0.tar.gz.

File metadata

  • Download URL: cursedspace-1.5.0.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for cursedspace-1.5.0.tar.gz
Algorithm Hash digest
SHA256 5d379f84280a637478f8ade2222fe96169355fa4b6a1678cc9b042e36eb6792e
MD5 8105f511d5ce6291c528466e5b492209
BLAKE2b-256 762dc3b3cbc58533a58de60a7c9f2ebc3559c7038e5faba7340623c15fae2394

See more details on using hashes here.

File details

Details for the file cursedspace-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: cursedspace-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for cursedspace-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0306bf0445e6e44d9fdd3b7cb96483792b895797e2cbd6af4a2ce813c88755af
MD5 da9301bcc8e76a5e34bfdad984672ed2
BLAKE2b-256 ac3dbc82374652f5c0c0a384e24b13ac67c52286a2fc5607df21d78b265bfc25

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