python rich.table - how to hide ONLY the right border?

79 views Asked by At

I am trying to use rich.table and would like to show only the top & left borders (i don't care about the bottom border).

Ideally, I would like to control & customize the borders from the cell or row level, but if not, hiding the right border at the table level would suffice.

the rich documentation describes border_style an optional constructor parameter to the rich.table.Table() class as such:

border_style (Union[str, Style], optional) – Style of the border. Defaults to None.

https://rich.readthedocs.io/en/stable/reference/table.html

I can't figure out how to configure this input --- or if it would even accomplish the task.

thank you!

I have tried every combination and permutation of style, list, tuple, set, list of lists, list of tuples, etc.

I have tried searching the world wide web.

1

There are 1 answers

0
August1328 On

I use rich tables in Python, but have not had the desire to change the border style so far, so I can just give you 2 additional links:

If you look into the rich docu under Tables, there is a small example at Border Styles:

from rich import box
table = Table(title="Star Wars Movies", box=box.MINIMAL_DOUBLE_HEAD)

See Rich Tables Border Style

There is also another link to examples of 19 different styles you can choose: Rich Box Constants

I guess when you look into the repo how these box constants are coded, you should be able to create your own style.