question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[REQUEST] prevent expansion of certain columns

See original GitHub issue

I’d like to be able to expand certain columns and keep others at a fixed width. This is possible right by now by setting expand=True on the table and setting ratio=1 (?) in the columns that can be expanded (see this discussion):

from rich.table import Table
from rich.text import Text
from rich import print


t = Table(box=None, padding=0, expand=True)
t.add_column(Text("x", justify="left"), justify="right", ratio=1)
t.add_column(Text("y", justify="left"), justify="right")
t.add_row("12", "12")
t.add_row("1234", "1234")

print(t)
x                                     y   
                                    12  12
                                  12341234

This is a little weird. A better API would be to have an expand attribute in each column that overrides the table’s expand.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
willmcgugancommented, Mar 7, 2022

The default is to fit the content, which means the column width can’t grow beyond the widest cell. It will only grow if you assign a proportion of the excess space via ratio.

Setting expand on the Table expands the table width, but it will still try to respect the existing column rules.

0reactions
github-actions[bot]commented, Mar 9, 2022

Did I solve your problem?

Why not buy the devs a coffee to say thanks?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to prevent item height expansion from expanding other ...
I'm trying to make a 3x3 grid with items that can be expanded and collapsed. When the user clicks on an item that...
Read more >
Optimize Power Query when expanding table columns
When expanding related rows from one table to another, the default behavior of Power BI is to generate a call to Table.ExpandTableColumn ....
Read more >
How to hide columns in Excel using shortcut, VBA or grouping
4 quick ways to hide and show columns in Excel: shortcut, ribbon menu, VBA, and grouping.
Read more >
Lock or Unlock Columns and Rows
To lock a column, right-click the column header and click Lock Column. Lock Column Menu · To lock a row, right-click a row...
Read more >
Column Permissions - monday.com Support
This is especially helpful if you have some sensitive information you don't want some users to see or change. How to restrict column...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found