The Wayback Machine - https://web.archive.org/web/20220107192327/https://github.com/Textualize/rich/discussions/1767
Skip to content

Is there any way to get the height of a panel programmatically? #1767

Unanswered
ZeroIntensity asked this question in Q&A
Is there any way to get the height of a panel programmatically? #1767
Dec 19, 2021 · 0 answers

I need to get the height of a panel inside of a layout. I've looked through the documentation and wasn't able to find anything.
Panel.height exists, but that returns None if it wasn't set manually.

Here's an example of what I am trying to do:

from rich.layout import Layout
from rich.panel import Panel

layout = Layout()

layout.split_column(
    Panel("something"),
    Panel("another_thing")
)

something_height: int = layout["something"].height

Replies

0 suggested answers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant