Skip to main content

Function to center text in the terminal

Project description

center-text

Python module to center text in the terminal.

This is my first Python module ever, so it's also where I learned to create modules for pypi, and was more so a learning experience than anything.

Installation

Install the package directly from PyPI using pip:

pip install center-text

Usage

from center import center_text

# Center text using standard spaces
center_text('Hello, World!')

# Center text using custom padding characters
center_text(' wow ', pad_str='~')
center_text(' casino ', pad_str=' 777 ')

Features

  • Auto-detects terminal width
  • Supports custom padding strings of any length
  • Forwards standard end and flush parameters to the underlying print() function.
  • Compatible with Python 3.3+

License

Licensed under the GNU Affero General Public License, or AGPL.

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

center_text-0.1.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

center_text-0.1.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file center_text-0.1.0.tar.gz.

File metadata

  • Download URL: center_text-0.1.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for center_text-0.1.0.tar.gz
Algorithm Hash digest
SHA256 346ebae18c9f1fd70f28c18c0e1c48635d5b54edb6181c30867a9a3e65dfbc89
MD5 0dc2e84634e5bb7a047191f5f50f1c5f
BLAKE2b-256 64dbebf7cfe1a074cd9c87f55b95e22de7551c099e9fafd4bc24b449d04320c1

See more details on using hashes here.

File details

Details for the file center_text-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: center_text-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for center_text-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0de43b8c672b502f131110fe03c871113549b1df9cac268e4d8f08067668726c
MD5 b8d78fa4e415363558c821d3fe1112b7
BLAKE2b-256 7d0c136a4404d6ae5cf5e1e561d556ab7165803b1b4378bc2fcf28148e006106

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page