-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
I tried to make a snug wrapper for multiple vertically laid out Pretty widgets but upon setting its and its containers widths to auto, the pretty widgets disappeared. In the attached image the left column showcases mentioned behavior, the right column showcases the same code with Labels instead of Pretty widgets for comparison
App: top-left
from textual.containers import Container, Vertical, Horizontal
from textual.widgets import Label, Pretty
from textual.app import App, ComposeResult
class Demo(App):
CSS = """
Vertical {
background: blue;
height: auto;
}
Pretty {
width: auto;
height: auto;
background: red;
}
"""
def compose(self) -> ComposeResult:
with Vertical():
yield Pretty('hello world')
yield Pretty('hello world')
yield Pretty('hello world')
if __name__ == "__main__":
Demo().run()App: bottom-left
from textual.containers import Container, Vertical, Horizontal
from textual.widgets import Label, Pretty
from textual.app import App, ComposeResult
from textual import events
class Demo(App):
CSS = """
Vertical {
background: blue;
height: auto;
width: auto;
}
Pretty {
width: auto;
height: auto;
background: red;
}
"""
def compose(self) -> ComposeResult:
with Vertical():
yield Pretty('hello world')
yield Pretty('hello world')
yield Pretty('hello world')
if __name__ == "__main__":
Demo().run()App: top-right
from textual.containers import Container, Vertical, Horizontal
from textual.widgets import Label, Pretty
from textual.app import App, ComposeResult
from textual import events
class Demo(App):
CSS = """
Vertical {
background: blue;
height: auto;
}
Label {
width: auto;
height: auto;
background: red;
}
"""
def compose(self) -> ComposeResult:
with Vertical():
yield Label('hello world')
yield Label('hello world')
yield Label('hello world')
if __name__ == "__main__":
Demo().run()App: bottom-right
from textual.containers import Container, Vertical, Horizontal
from textual.widgets import Label, Pretty
from textual.app import App, ComposeResult
from textual import events
class Demo(App):
CSS = """
Vertical {
background: blue;
height: auto;
width: auto;
}
Label {
width: auto;
height: auto;
background: red;
}
"""
def compose(self) -> ComposeResult:
with Vertical():
yield Label('hello world')
yield Label('hello world')
yield Label('hello world')
if __name__ == "__main__":
Demo().run()
Textual Diagnostics
Versions
| Name | Value |
|---|---|
| Textual | 5.3.0 |
| Rich | 14.1.0 |
Python
| Name | Value |
|---|---|
| Version | 3.12.9 |
| Implementation | CPython |
| Compiler | GCC 14.2.1 20250207 |
| Executable | /home/matej/.pyenv/versions/3.12.9/envs/gsutil/bin/python |
Operating System
| Name | Value |
|---|---|
| System | Linux |
| Release | 6.15.7-arch1-1 |
| Version | #1 SMP PREEMPT_DYNAMIC Thu, 17 Jul 2025 21:05:29 +0000 |
Terminal
| Name | Value |
|---|---|
| Terminal Application | Kitty |
| TERM | xterm-kitty |
| COLORTERM | truecolor |
| FORCE_COLOR | Not set |
| NO_COLOR | Not set |
Rich Console options
| Name | Value |
|---|---|
| size | width=75, height=47 |
| legacy_windows | False |
| min_width | 1 |
| max_width | 75 |
| is_terminal | True |
| encoding | utf-8 |
| max_height | 47 |
| justify | None |
| overflow | None |
| no_wrap | False |
| highlight | None |
| markup | None |
| height | None |
Metadata
Metadata
Assignees
Labels
No labels