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
Applicationis the main application class and provides boilerplate initialisationsPanelis a basic panel with support for borders and key handling in the context of anApplicationInputLineis a panel with very basic editing support.Keyprovides a convenient wrapper around curses’ key system. It can be used standalone even when you don’t want to useApplicationorPanel.ShellContextis a convenient wrapper to execute external processes (e.g. through subprocess) and returning to the curses context afterwards again.colorsis a generic way to define colors in pairs (foreground and background) and have them automatically registerd for use in curses. You only have to callcolors.attr(ColorPair(...))to use a new color combination (limited by the terminal, of course).
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
cursedspace-1.4.1.tar.gz
(18.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cursedspace-1.4.1.tar.gz.
File metadata
- Download URL: cursedspace-1.4.1.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 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.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7270815569e92dd945d7e124ef6bb0697b9494eb82fb363b04c40d826279ae2f
|
|
| MD5 |
544ff9a7d5e95ab49f50f0806b2bc7b3
|
|
| BLAKE2b-256 |
38f5e5d5493a819ffdb71f6fcef6ef244c9a57beca57f090f55f722c3820cd51
|
File details
Details for the file cursedspace-1.4.1-py3-none-any.whl.
File metadata
- Download URL: cursedspace-1.4.1-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 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.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7ab5f4a46e867593b5b2832068ccaaf3bebcf6ab4742f926bd3826cd925ee0c
|
|
| MD5 |
ecff0b39a15875901f1c0e3c4a19e05b
|
|
| BLAKE2b-256 |
b46c1c79d44398379a24e62d7951103092776e1adb13cbe0c56e33bff4a3653e
|