-
For an accounting-related application it's useful to have the decimal places align. I tried the following, but whatever I do, text is on left:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
As you've found, those styles don't affect the way from textual.app import App, ComposeResult
from textual.widget import Widget
from textual.widgets import Input
class RightInput(Widget):
DEFAULT_CSS = """
RightInput {
width: 1fr;
height: auto;
align-horizontal: right;
}
RightInput Input {
width: auto;
}
"""
def compose(self) -> ComposeResult:
yield Input()
class RightAlignInput(App[None]):
def compose(self) -> ComposeResult:
yield RightInput()
yield RightInput()
yield RightInput()
yield RightInput()
if __name__ == "__main__":
RightAlignInput().run() I guess, ideally, this would be fleshed out so that As the core of an approach though I think it would be workable. |
Beta Was this translation helpful? Give feedback.
As you've found, those styles don't affect the way
Input
displays its content; as of right now I don't believe there is a way to do what you're looking for. I think, if I were to do what you're doing, I'd wrapInput
and make itsize: auto
, align it right in the container widget, and work from there. For example: