A python package which adds simple cli tools to your python project.
Project description
Python clitools
This package removes annoying boilerplate code that you will see you write yourself over and over again to create a pleasant cli-centered user interface.
Installation
For more information, check out the PyPi page
to install the newest version, use:
pip install JefvdA-python-clitools
Tools
The tools are methods that are used most-often.
These include:
- clear() -> OS independant method to clear the terminal
- wait_for_enter() -> method to wair for user input before continuing, clears the screen after
- get_user_input() -> method to returns user input. This method formats the text printed for the input to add " >>> " after it. Example: "What is your name?", becomes, "What is your name? >>> "
Menu
A "Menu" class that makes it very easy to display a menu in the terminal, and have different results for all the options the user can choose from.
When initiating a new "Menu" object, make sure to pass it all the options, aswell as their corresponding fucntions.
Example:
menu_options = {
"Hello world": say_hello_world,
"Greet by name": ask_for_name,
"Get random number": get_random_number,
"Exit": exit
}
menu = Menu(menu_options)
When a "Menu" option is created, it can be displayed with the "show()" method.
menu.show()
This will only run the menu once, if you wish to keep displaying the menu. Wrap the "show" in a while loop + add an option to exit the program
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
Built Distribution
Hashes for JefvdA_python_clitools-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | df58884b403c2a22946d59cfccf91f5ebfe1ba4328415e2062d34ec34c577aa3 |
|
MD5 | c3fcfa7bcc5c3458bf9534a6d7217717 |
|
BLAKE2b-256 | a071ede0ca47ef6bad9c0ba5b5b7a5afa4e1536471b48ff33c9ae01c071f84e2 |
Hashes for JefvdA_python_clitools-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edb8f855da0a389a648c26e9321654c2d52b5c70f1228517b79d3729bef673fb |
|
MD5 | d1b3752c5a1dd446503f8f04d04d1cc1 |
|
BLAKE2b-256 | cf33c03ff5610d0ec5b950a2f1cc808cb2d613d78bab74ec9ae553d679027dbf |