-
Notifications
You must be signed in to change notification settings - Fork 844
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4369 from Textualize/auto-width
width fix
- Loading branch information
Showing
7 changed files
with
211 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.containers import Vertical | ||
from textual.widgets import Label | ||
|
||
|
||
class Width100PCentApp(App[None]): | ||
|
||
CSS = """ | ||
Vertical { | ||
border: solid red; | ||
width: auto; | ||
Label { | ||
border: solid green; | ||
} | ||
#first { | ||
width: 100%; | ||
} | ||
#second { | ||
width: auto; | ||
} | ||
} | ||
""" | ||
|
||
def compose(self) -> ComposeResult: | ||
with Vertical(): | ||
yield Label("I want to be 100% of my parent", id="first") | ||
yield Label( | ||
"I want my parent to be wide enough to wrap me and no more", id="second" | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
Width100PCentApp().run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters