Skip to main content

Simple, colorful, multi-mode TUI that requires no boilerplate

Project description

Selecto

Selecto is a colorful, simple-to-use Text User Interface (TUI) library that requires just 1 line of code to get started. It's designed to make building beautiful and interactive CLI apps a breeze.

Features

  • Easy to use.
  • Colorful and interactive interface.
  • Requires only 1 line of code to run.
  • No external dependencies – everything you need is built-in.
  • Dual mode: Select one item or multiple items.
    • Single mode: Select a single item and return it.
    • Multiple mode: Select multiple items and return them as a list.
  • Automatic Adjustment to terminal height: selecto can automatically detect the number of available lines, then will dynamically adjust what options are shown in a way that keeps the cursor always visible and ideally in the center

Installation

You can install Selecto via pip:

pip install selecto

Usage

To control selecto, arrow keys provide navigation: arrow up and down to move a single row arrow left and right to move multiple rows (number of rows configurable) return key to select item in single selection mode space key to toggle item and return key to confirm selections in multiple selection mode Q to exit

To start selecto in the single selection mode (default mode):

from selecto import selecto

choice=selecto(list(range(50)))

if choice is not None:
    print(choice)

# > 0
#   1
#   2
#   3
#   4
#   5
#   6
#   7
#   8
#   9
#   10
#   11
#   12
#   13

# Item 1 of 50
# Press 'Q'  to exit, 'Enter' to confirm selection.

To start selecto in multiple selection mode:

from selecto import selecto

choice=selecto(list(range(50)),select_multiple=True) # by default value set to False

if choice is not None:
    print(choice)

# > [ ] 0
#   [ ] 1
#   [ ] 2
#   [ ] 3
#   [ ] 4
#   [ ] 5
#   [ ] 6
#   [ ] 7
#   [ ] 8
#   [ ] 9
#   [ ] 10
#   [ ] 11
#   [ ] 12
#   [ ] 13

# Item 1 of 50
# Press 'Q'  to exit, 'Space' to toggle selection, 'Enter' to confirm selection(s).

To change the number of rows left and right arrow keys jump:

from selecto import selecto

choice=selecto(list(range(50)),multi_index_jump=25) # default is 5

if choice is not None:
    print(choice)

Selecto has randomized messages on exit or errors, to toggle them:

from selecto import selecto

choice=selecto(list(range(50)),exit_messages=True) # True by default, False replaces all messages with generic messages

if choice is not None:
    print(choice)

# > 0
#   1
#   2
#   3
#   4
#   5
#   6
#   7
#   8
#   9
#   10
#   11
#   12
#   13

# Item 1 of 50
# Press 'Q'  to exit, 'Enter' to confirm selection.
#Houston, we have a problem!

choice=selecto(list(range(50)),exit_messages=False) # True by default, False replaces all messages with generic messages

if choice is not None:
    print(choice)

# > 0
#   1
#   2
#   3
#   4
#   5
#   6
#   7
#   8
#   9
#   10
#   11
#   12
#   13

# Item 1 of 50
# Press 'Q'  to exit, 'Enter' to confirm selection.
#Exiting.

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

selecto-1.0.5.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

selecto-1.0.5-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file selecto-1.0.5.tar.gz.

File metadata

  • Download URL: selecto-1.0.5.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for selecto-1.0.5.tar.gz
Algorithm Hash digest
SHA256 4dd7fdf62dde780be1e41857cb63f6ff1b1df525b100b77bacb269df0f2da031
MD5 4d2566326573d110d3bb5cefb7991cad
BLAKE2b-256 39e62fc67e8058fc6a77151ae408557d33f7444bdc2bc7c79fcd5a9a66dfd49b

See more details on using hashes here.

File details

Details for the file selecto-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: selecto-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for selecto-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d889236947b4fafefebfbb1cb4a16fc685c5f41252a75bc575097125a0cada51
MD5 e63b31236ede2aeec168563af62b50a7
BLAKE2b-256 e6a4a6ae6c61e75e85672a2ffdb4a4bd7ca185c62510512cca9ae9518d753172

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