You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might be less specific that the subject suggests, but so far it's the only combination I've been able to use to create this problem. Given the following code, and given a sufficiently-sized terminal (in respect to width), you would expect every Horizontal in the result to reach the edge of the screen and either clip its content (for width: 1fr) or have itself be clipped (width: auto).
fromtextual.appimportApp, ComposeResultfromtextual.containersimportHorizontalfromtextual.widgetsimportButton, LabelclassHorizontalWidthAutoApp(App[None]):
CSS=""" Horizontal { border: solid red; height: auto; &.auto { width: auto; } Button, Label { margin-left: 1; } } """defcompose(self) ->ComposeResult:
withHorizontal(classes="auto"):
forninrange(10):
yieldButton(f"{n} This is a very wide button {n}")
withHorizontal():
forninrange(10):
yieldButton(f"{n} This is a very wide button {n}")
withHorizontal(classes="auto"):
forninrange(10):
yieldLabel(f"{n} This is a very wide label {n}")
withHorizontal():
forninrange(10):
yieldLabel(f"{n} This is a very wide label {n}")
if__name__=="__main__":
HorizontalWidthAutoApp().run()
The result, however, is different from what would be expected:
In this case the width: autoHorizontal that contains Buttons seems to come up short.
The text was updated successfully, but these errors were encountered:
It looks like the key difference is that the Button text can wrap, so the container's auto width is calcuated based on the minimum width of the widget rather than the optimal width of the renderable?
fromtextual.appimportApp, ComposeResultfromtextual.containersimportHorizontalfromtextual.widgetsimportButtonclassHorizontalWidthAutoApp(App[None]):
CSS=""" Horizontal { border: solid red; height: auto; width: auto; } Button { margin-left: 1; } """defcompose(self) ->ComposeResult:
withHorizontal(classes="auto"):
yieldButton("This is a very wide button")
withHorizontal(classes="auto"):
yieldButton("This is a very wide button")
yieldButton("This is a very wide button")
if__name__=="__main__":
HorizontalWidthAutoApp().run()
This might be less specific that the subject suggests, but so far it's the only combination I've been able to use to create this problem. Given the following code, and given a sufficiently-sized terminal (in respect to width), you would expect every
Horizontal
in the result to reach the edge of the screen and either clip its content (forwidth: 1fr
) or have itself be clipped (width: auto
).The result, however, is different from what would be expected:
In this case the
width: auto
Horizontal
that containsButton
s seems to come up short.The text was updated successfully, but these errors were encountered: