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

feat(input): add clear method #3430

Merged
merged 3 commits into from
Sep 29, 2023

Conversation

TomJGooding
Copy link
Contributor

@TomJGooding TomJGooding commented Sep 29, 2023

Closes #3428 by adding a Input.clear method.

Example usage:

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


class InputApp(App):
    def compose(self) -> ComposeResult:
        yield Input(placeholder="Enter some text and press enter")

    def on_input_submitted(self, event: Input.Submitted) -> None:
        self.notify(f"You entered '{event.value}'")
        event.input.clear()


if __name__ == "__main__":
    app = InputApp()
    app.run()
  • Docstrings on all new or modified functions / classes
  • Updated documentation
  • Updated CHANGELOG.md (where appropriate)

@willmcgugan
Copy link
Collaborator

Thanks, Tom.

@willmcgugan willmcgugan merged commit 3f36989 into Textualize:main Sep 29, 2023
23 checks passed
@TomJGooding TomJGooding deleted the feat-input-add-clear-method branch September 29, 2023 14:23
@stefgmz stefgmz mentioned this pull request Oct 16, 2023
3 tasks
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.

[FEAT] Add Input.clear method
2 participants