A set of utilities for use in a terminal
Project description
terminalutilities
A set of utilities for use in a terminal.
Progress Bar
A progress bar used to track the progress of a value from 0 to some maximum value, printing in-place (overwriting) this progress.
Usage
Initialise the bar by creating a ProgressBar object, passing at least a title and a maximum value, then call Update with the new value. Once the value has reached its maximum, call Complete to finalise the bar and continue with the program.
Example
n = 999999
pb = terminalutilities.ProgressBar("Doing", n)
x = 0
while x < n:
x += 1
pb.Update(x)
pb.Complete()
Selection Menu
A selection menu used to allow the user to execute one of a set of prebuilt commands.
Usage
Set up a list of 'options', which are dictionaries with keys
name: The name of the optionaliases: A list of all the words that will trigger this optiondesc: A description of the optionfunc: The function to be executed upon selecting this option; such a function must take in a single argumentargswhich is a list of all words given after the trigger word (e.g. inputting 'test arg1 arg2' makesargs == ['arg1', 'arg2']; inputting 'test' makesargs == []).
Two options are included by default: "Help", which displays a list of all the options available to this menu; and "Quit", which quits the menu.
The menu will continue prompting the user until one of the functions it calls returns something not None (the function for "Quit" returns -1)
Example
def TestOption(args):
print("test option's function is working")
options = [ {"name": "testoption",
"desc": "this is a test option",
"aliases": ["testoption", "test", "t", "testop"],
"func": TestOption} ]
SelectionMenu(options)
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
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 terminalutilities-0.0.1.tar.gz.
File metadata
- Download URL: terminalutilities-0.0.1.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.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.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d990f4b3904a4a02ad55794f1123e5e01819ed36095d75082212e57805c4715
|
|
| MD5 |
530d129258e2d14516fc4816fad74e5c
|
|
| BLAKE2b-256 |
caf351df76a2d5553d1f14daa85ae52eaa8350c5707bbf0e9d01acdf98f09806
|
File details
Details for the file terminalutilities-0.0.1-py3-none-any.whl.
File metadata
- Download URL: terminalutilities-0.0.1-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.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.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b55bdfeb1427056d52e41955f14f537b062ca90fb3d09adf3fc78c9813ba1b95
|
|
| MD5 |
bdd2fe3a8f4c53d4c8783e1d2ef9117d
|
|
| BLAKE2b-256 |
05193287d2046db74e08e58fe2cc38df13924981d63b0e6e40cc5c2363c6dbab
|