Skip to main content

A text-based UI system

Project description

# Python textui package
Text-based UI builder for Python

Full documentation provided at

## Quickstart

Install from `pip`: `pip install --user textui`

The `uielements` module contains individual `user_*` functions that can be
used to interactively get values:

from textui import uielements

>>> uielements.user_input_list('Choose your favorite fruit', ['Apple', 'Banana', 'Cherry'])
Choose your favorite fruit
A empty answer will cancel.
1: Apple 2: Banana 3: Cherry
Enter 1-3: 2

>>> uielements.user_input_date('When did the Eagle land on the moon?')
When did the Eagle land on the moon?
Enter in one of the formats: yyyy-mm-dd
Entering nothing will cancel
--> 1969-07-20
datetime.datetime(1969, 7, 20, 0, 0)

`uielements` also contains a series of `opt_user_*` functions that will decide if the
user needed to be queried based on the given value, or check is the value is valid:

# If the value None is given, it is assumed
# that the user need to provide a value
>>> uielements.opt_user_input_list('Choose your favorite fruit', None, ['Apple', 'Banana', 'Cherry'])
Choose your favorite fruit
A empty answer will cancel.
1: Apple 2: Banana 3: Cherry
Enter 1-3: 2

# If a non-None value is given, it is checked.
# So long as it is valid, it is returned.
>>> uielements.opt_user_input_list('Choose your favorite fruit', 'Apple', ['Apple', 'Banana', 'Cherry'])

# If not valid, an error is raised automatically
>>> uielements.opt_user_input_list('Choose your favorite fruit', 'Watermelon', ['Apple', 'Banana', 'Cherry'])
Error thrown using UIErrorWrapper
UIValueError: The value Watermelon is invalid. It must be one of: Apple, Banana, Cherry

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for textui, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size textui-0.2-py2.py3-none-any.whl (19.2 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size textui-0.2.tar.gz (16.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page