Skip to main content

A small package for creating TUI applications

Project description

tuindow -- A small package for creating TUI applications

Requirements

Tested on python versions 3.8 - 3.11

This package makes use of the builtin curses module, so it's only available on Linux. I will probably look into testing and supporting Windows in the future. I do not have a macOS device to test on and so won't be supporting the OS.

Installation

python3 -m pip install tuindow

Basic Usage

import tuindow

panel = tuindow.Panel()


def layout(width: int, height: int) -> None:
    panel.rect = (0, 0, width, height)


with tuindow.init(layout):
    tuindow.set_active_cursor(panel.cursor)

    while 1:
        for key in tuindow.keys():
            if key == tuindow.DOWN or key == "\n":
                try:
                    panel.cursor.down()
                except tuindow.Overscroll:
                    pass

            elif key == tuindow.UP or (
                panel.cursor.index == 0 and key == tuindow.BACKSPACE
            ):
                try:
                    panel.cursor.up()
                except tuindow.Overscroll:
                    pass

            elif key == tuindow.RIGHT:
                panel.cursor.right()

            elif key == tuindow.LEFT:
                panel.cursor.left()

            elif key == tuindow.ESCAPE:
                exit(0)

            elif key == tuindow.BACKSPACE:
                panel.cursor.backspace()

            elif key == tuindow.DELETE:
                panel.cursor.delete()

            elif key in tuindow.PRINTABLE:
                panel.cursor.insert(key)

        tuindow.draw(panel)
        tuindow.update()

A More Advanced Example

This will create the code for a simple text editor in the current working directory and open the file using the editor itself. In the future there may be more examples available using this method.

python3 -m tuindow

More Documentation

The source code is documented fairly thoroughly.

For more documentation refer to the source code or get it interactively for specific objects using the python help builtin at an interactive prompt.

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

tuindow-1.0.2.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

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

tuindow-1.0.2-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file tuindow-1.0.2.tar.gz.

File metadata

  • Download URL: tuindow-1.0.2.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for tuindow-1.0.2.tar.gz
Algorithm Hash digest
SHA256 352dedbc08c90fdc0be8d72beb057922da5badec1e09c055a3095d956deb1feb
MD5 0795f501924d0a6154a76cf8b31d5494
BLAKE2b-256 545333cc0b6f83404d9669638963857866619d2e653a3362625ac8ddf4f89627

See more details on using hashes here.

File details

Details for the file tuindow-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: tuindow-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 24.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for tuindow-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 10fafbe5f8ec11baf094e17cb64aaf876659bbfdda8e44ed1cf17eb1afdaca86
MD5 67fcfbf935de96f00bcc0c520d78380a
BLAKE2b-256 0f552056df47515b6195cde8cf0c4d4d50588b35a8e35b22739d5b7a4f707242

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