Skip to main content

This module allows you to align text relative to the center, right, left and both sides

Project description

TextAlign

Last version: 1.0.5

Short description:

This module allows you to align text relative to the center, right, left and both sides

It contains:

  1. right(text, width) - this function align the "text" to right side with given "width"
  2. left(text, width) - this function align the "text" to left side with given "width"
  3. center(text, width) - this function align the "text" to center with given "width"
  4. justify(text, width) - this function align the "text" to both sides with given "width"

How to use:

from text_align import justify


my_long_text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis dolor mauris, at elementum ligula tempor eget. In quis rhoncus nunc, at aliquet orci. Fusce at dolor sit amet felis suscipit tristique. Nam a imperdiet tellus. Nulla eu vestibulum urna. Vivamus tincidunt suscipit enim, nec ultrices nisi volutpat ac. Maecenas sit amet lacinia arcu, non dictum justo. Donec sed quam vel risus faucibus euismod. Suspendisse rhoncus rhoncus felis at fermentum. Donec lorem magna, ultricies a nunc sit amet, blandit fringilla nunc. In vestibulum velit ac felis rhoncus pellentesque. Mauris at tellus enim. Aliquam eleifend tempus dapibus. Pellentesque commodo, nisi sit amet hendrerit fringilla, ante odio porta lacus, ut elementum justo nulla et dolor."
aligned_text = justify(my_long_text, 55)
print(aligned_text)
'''
Output:

Lorem  ipsum  dolor  sit  amet,  consectetur adipiscing
elit.  Vestibulum  sagittis  dolor mauris, at elementum
ligula  tempor  eget.  In quis rhoncus nunc, at aliquet
orci. Fusce at dolor sit amet felis suscipit tristique.
Nam  a  imperdiet  tellus.  Nulla  eu  vestibulum urna.
Vivamus  tincidunt  suscipit  enim,  nec  ultrices nisi
volutpat ac. Maecenas sit amet lacinia arcu, non dictum
justo.  Donec  sed  quam  vel  risus  faucibus euismod.
Suspendisse  rhoncus  rhoncus felis at fermentum. Donec
lorem   magna,  ultricies  a  nunc  sit  amet,  blandit
fringilla  nunc.  In  vestibulum velit ac felis rhoncus
pellentesque.  Mauris  at tellus enim. Aliquam eleifend
tempus  dapibus.  Pellentesque  commodo,  nisi sit amet
hendrerit   fringilla,   ante   odio  porta  lacus,  ut
elementum justo nulla et dolor.
'''

Installation:

pip install text-align==1.0.5

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

text_align-1.0.5.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

text_align-1.0.5-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file text_align-1.0.5.tar.gz.

File metadata

  • Download URL: text_align-1.0.5.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for text_align-1.0.5.tar.gz
Algorithm Hash digest
SHA256 7d329ba53a2f5772acd67e98d55e9285128a7cc829bfb8ac010485728a80bf04
MD5 c3bf169f6f9c98de05b8286e82caf5ca
BLAKE2b-256 13e3bed8d5e35d3a3cc356225d98c8b732b9c8afdfc4b2d56d19ebfcd98c949f

See more details on using hashes here.

File details

Details for the file text_align-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: text_align-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for text_align-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4bdf30e2f9c8b8d1d8cf8003e30a4585faf2a1767cfa46f68913573b14e61d36
MD5 6995cc7b2c5c79925ae9b6d5bb59b0d6
BLAKE2b-256 f8af67bb1bb764cf48f8b4015a29505710417ee40c9a48b5f40f2cb030f41104

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