Skip to main content

A class for drawing table in text console for python in windows or linux

Project description

TextTable

TextTable is a lightweight Python module that helps developers draw well-formatted tables in the console using ASCII or Unicode box-drawing characters.

It is designed for command-line applications where clear tabular output and optional pagination are required.


Features

  • Draw tables using ASCII or Unicode borders
  • Support for single-line, double-line, and dashed table styles
  • Automatic column width calculation
  • Left, right, and center text alignment
  • Pagination support for large datasets
  • Cross-platform (Windows, Linux, macOS)

Installation

pip install texttable

Basic Usage

from Texttable import TextTable

t = TextTable(ttype='=', page_size=10)

t.set_columns(['Column 1', 'Column 2', 'Column 3'])

t.add_row(['Data 1', 'Data 2', 'Data 3'])

t.add_row(['More', 'Sample', 'Values'])

print(t)

Pagination Example

from Texttable import TextTable

t = TextTable(ttype='-', page_size=5)

t.set_columns(['ID', 'Name', 'Value'])

for i in range(20):

t.add_row([str(i), f'Item {i}', str(i * 10)])

t.print_with_pagination()

##Use keyboard input to navigate:

1 → Next page

2 → Previous page

0 / Enter → Exit

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

pytexttable-0.1.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

pytexttable-0.1.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pytexttable-0.1.1.tar.gz.

File metadata

  • Download URL: pytexttable-0.1.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for pytexttable-0.1.1.tar.gz
Algorithm Hash digest
SHA256 551da35d0cfd7226f713270458f2d475848740f65979ea69d3c36638723b27e1
MD5 37803bff3bcd478fcaf002ecf601c1c2
BLAKE2b-256 c55119701fe6e0efe5902b0f68d9c80512f08cdc45a2aa6eed40f516f092c69d

See more details on using hashes here.

File details

Details for the file pytexttable-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pytexttable-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for pytexttable-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f4f1c135100782390ac132f8b7407ff8977137f9d5d4fc94cd396cda3c1f524
MD5 74a59eae9c32672456f06cee069e93fc
BLAKE2b-256 57cd85afe5c50cd710cb073c5d8e2c1c0be403c3f8f10b4787be1f5677fd4385

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