A Python library that allows you to center horizontally and vertically (or both) and align right strings in the terminal.
Project description
Termiline: Terminal Text Alignment Utilities
This module offers functions for aligning text in the terminal, making it easier to create visually appealing command-line interfaces. It includes options for centering text horizontally and vertically, as well as right-aligning text.
Install
- Windows:
pip install termiline - MacOS/Linux/Unix:
pip(3, or python version you are using) install termiline
Functions
centerX(str, adjust=0)
Centers text horizontally within the terminal.
-
Parameters:
str(str): The text to center.adjust(int, optional): Additional spaces for centering adjustment (default is0).
-
Returns:
- Centered text as a string.
centerY(str, uadjust=0, dadjust=0)
Centers text vertically in the terminal.
-
Parameters:
str(str): The text to center.uadjust(int, optional): Spaces above the text (default is0).dadjust(int, optional): Spaces below the text (default is0).
-
Returns:
- Vertically centered text as a string.
alignRight(str, ladjust=0)
Aligns text to the right side of the terminal.
-
Parameters:
str(str): The text to align.ladjust(int, optional): Additional spaces to the left of the text (default is0).
-
Returns:
- Right-aligned text as a string.
Compatibility
- Python version: 3 and above.
Troubleshooting
- Misplacement: Ensure your string has no extra spaces. For example, use "text" instead of "text ".
Usage
To use the functions, import the module in your script:
import termiline
# Example usage
print(termiline.centerX("Horizontally Centered Text"))
print(termiline.centerY("Vertically Centered Text"))
print(termiline.alignRight("Right Aligned Text"))
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 termiline-1.0.1.post0.tar.gz.
File metadata
- Download URL: termiline-1.0.1.post0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
137cf45c30c132d5d663f80bca7a78918263f64da7c2d1083c92f8c0c3dbd4a0
|
|
| MD5 |
9040bf157e1b13d078fd541d70074be8
|
|
| BLAKE2b-256 |
6c035d451a1863c76ac3b8c907276af59edaf5033456eef97979ecbd6fbe7654
|
File details
Details for the file termiline-1.0.1.post0-py3-none-any.whl.
File metadata
- Download URL: termiline-1.0.1.post0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
902eb64526c74243090d57a435b4ed8bb7956902df7121028b418ed70c344a7f
|
|
| MD5 |
289cd1879a41292d14f5109504723252
|
|
| BLAKE2b-256 |
d6230be83a52376f4b38c52d10bd33af8dd614de2e8ab90544423f0c641726f3
|