Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

button tweak #3539

Merged
merged 2 commits into from
Oct 16, 2023
Merged

button tweak #3539

merged 2 commits into from
Oct 16, 2023

Conversation

willmcgugan
Copy link
Collaborator

Makes buttons a little more flexible. They now have auto height, and a padding will be applied to all lines.

Copy link
Contributor

@davep davep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sense this needs a nice big juicy "breaking change" entry in the CHANGELOG given it'll have knock-on effects for layouts in applications. With this code:

from textual.app import App, ComposeResult
from textual.widgets import Button

class ButtonsApp(App[None]):

    def compose(self) -> ComposeResult:
        for n in range(5):
            yield Button(f"Button {n}\n" * (n+1))

if __name__ == "__main__":
    ButtonsApp().run()

going from this:

Screenshot 2023-10-15 at 17 49 15

to this:

Screenshot 2023-10-15 at 17 49 36

@willmcgugan
Copy link
Collaborator Author

Why would anyone have buttons with new lines that don't display?

@davep
Copy link
Contributor

davep commented Oct 15, 2023

Accidentally doing it would be the most obvious cause; or having observed only the first line shows and unfortunately relying on that. Given this would cause visible layout changes it seems prudent to me to give everyone a heads up in the document intended for that.

@willmcgugan
Copy link
Collaborator Author

I've added a changelog, but I don't see that as a breaking change. A visual change, certainly, but we've not marked such changes as breaking in the past.

@willmcgugan willmcgugan merged commit 6ed6011 into main Oct 16, 2023
23 checks passed
@willmcgugan willmcgugan deleted the button-render branch October 16, 2023 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants