Add border_title and border_subtitle as kwargs to Widget constructor #3807
davetapley
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
I'm pretty sure this has come up before and we've resisted this as it adds even more keyword arguments to the already-busy constructor of every widget that defines its own For what it's worth, the pattern I use is this: with Collection(classes="section") as collection:
collection.border_title="Collection"
yield Select(options, allow_blank=False) Or, where it's been more useful, I've even taken to having a with title(Collection(classes="section"), "Collection"):
yield Select(options, allow_blank=False) where def title(widget: Widget, title: str) -> Widget:
widget.border_title = title
return widget |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently you can set
border_title
like this:textual/docs/examples/guide/widgets/hello06.py
Lines 23 to 26 in cb61239
Or like this:
textual/docs/examples/styles/border_title_colors.py
Lines 11 to 13 in cb61239
I have a third use-case where I'd like to set it on a
Container
. Inspired by this I came up with:Use like this:
But then it occurred to me that this would (I think) be nicer:
Any thoughts / concerns? Happy to have a go at a PR.
Beta Was this translation helpful? Give feedback.
All reactions