Some personal tools for working with the terminal in Python.
Project description
terminaltools
⌨ Some personal tools for working with the terminal in Python.
This package contains some useful functions I created for my personal use in Python terminal projects, including styling and querying the user.
⚠ Please note that this package is almost certainly laced with bugs, so use it at your own risk! If you encounter any issues, please create an issue on GitHub (https://github.com/ericli3690/terminaltools) or email me at ericli3690@gmail.com.
🛠 Installation and Use
>> pip install terminaltools
from terminaltools import function_name_here
function_name_here(arguments_here)
🎨 Color Functions
Available Colors
BLACK, RED, GREEN, YELLOW, BLUE, PURPLE, CYAN, WHITE
marker(color)
Returns the escape sequence for a given color.
colored(text, color)
Returns the text parameter as a given color.
color_print(text, color, is_input, insert_end)
Prints the text parameter as a given color.
insert_end is used for the 'end' parameter in print statements; is_input will allow an input to be created instead.
🖨 Other Printing Functions
delay(interval)
Repeatedly refreshes the line, inputting a new dot every second until the amount of dots equals parameter INTERVAL (in seconds).
nest(text, top_icon, side_icon, corner_icon, left_right_padding, up_down_padding)
DEFAULTS TO: None, '=', '', '', 0, 0
Nests 'text' in a box with 'top_icon' on the top and bottom, 'side_icon' on the left and right, and 'corner_icon' on the corners; can also add interior padding via left_right_padding and up_down_padding.
Returns a string.
Try nesting nests in nests!
❓ Querying the User
ask(prompt, filter, disallow_null, clear_console, colors)
define a filter, then call ask:
def myFilter(reply):
if (reply == "0"):
return False, 'This value is not allowed.'
else:
return True, 'Value accepted.'
ask("Enter a non-zero character.", myFilter)
Warning: this uses eval().
Your filter may be named anything, but its argument MUST be called "reply"
disallow_null is true by default; clear_console on user success and failure are both false by default; success color and failure color are green and red respectively by default.
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
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 terminaltools-0.1.1.tar.gz.
File metadata
- Download URL: terminaltools-0.1.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c02b4f98ad9aba80f7268326753ceecf7345ec92518b29590153ca46137acf55
|
|
| MD5 |
2b65629e6e6d8fb3ef4e04f9e0b0578c
|
|
| BLAKE2b-256 |
c5e82243bcba6fd3de54146be0b5b070a68bb8abc778cf82e60529e4d1232c5f
|
File details
Details for the file terminaltools-0.1.1-py3-none-any.whl.
File metadata
- Download URL: terminaltools-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
559e8161f64b4a35505eb2a59a1d6a466439fca5240464607392d4e2b1fe8d3f
|
|
| MD5 |
b8123df103eb184b14d565b7e27a91e9
|
|
| BLAKE2b-256 |
3645d1ec2e722c4ff6dbdd6137e655d082a5423b4b4f70e115420111a792392a
|