Skip to main content

based on curses, ovtable is a table displayed in the terminal with Python API

Project description

ovtable

build coverage pypi support-version license commit

๐Ÿ’ป based on curses, ovtable is a table displayed in the terminal with Python API

Installation

Install via pip:

python -m pip install -U prettytable

Or install from source:

git clone git@github.com:PiperLiu/ovtable.git
cd ovtable
make refresh

Get the best experience with Monospaced Fonts! e.g. Let's get Fira Code!

Tutorial on how to use ovtable

>>> import ovtable

>>> ot = ovtable.OvTable(60, 30, True)
>>> # 60 is width, 30 is height
>>> # True means you want to use __str__
>>> # False means you want to render it (use ot.render())

>>> ot.add_row(1)
>>> ot[0, 0] = "Hello, OvTable"
>>> print(ot)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      Hello, OvTable                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

>>> ot.add_row(2)
>>> ot[1, 0] = [("I'm red", "r"), (" ok, I'm blue", "b")]
>>> ot[1, 1] = "I am in row 2, col 2"
>>> print(ot)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      Hello, OvTable                      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚    I'm red ok, I'm blue    โ”‚    I am in row 2, col 2     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

With ot[x, y] = value or ot[x, y] = [(s1, color1), (s2, color2), ...], we can render some interesting things! See ./examples/.

python examples/walker.py as below:

Why not PrettyTable?

Why created ovtable when we already have PrettyTable?

Well, mainly two reasons:

  • First, PrettyTable does not support different number of rows per line.
  • Second, our APIs is more suitable for rendering tables dynamically.

Contribution

We welcome all forms of contributions (including but not limited to issues and pull requests).

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

ovtable-0.0.3.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

ovtable-0.0.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file ovtable-0.0.3.tar.gz.

File metadata

  • Download URL: ovtable-0.0.3.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.14

File hashes

Hashes for ovtable-0.0.3.tar.gz
Algorithm Hash digest
SHA256 95fd9be3c897e298b736c78225a4fc767d6b9317a29b086ca6db15ad44499bae
MD5 b1fde079908c2b5a51a9e6f639236599
BLAKE2b-256 3ceef5fef9a9666956a3d20d9c995d7ad4a7133db9f4ee2168f43516631c2f8e

See more details on using hashes here.

File details

Details for the file ovtable-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: ovtable-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.14

File hashes

Hashes for ovtable-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 13f354d67da52357949e880814e75241f47337f9b7c119e5cb2a49f1fe765279
MD5 57481394a7dcfb66606e1abc7c356e70
BLAKE2b-256 17e041c39093fcbf4aed8d55a84807403662cc0e5d8a76a7ea82aa74f1a8d802

See more details on using hashes here.

Supported by

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