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

The disabled parameter for a TabPane should disable a tab #3149

Closed
davep opened this issue Aug 23, 2023 · 1 comment · Fixed by #3152
Closed

The disabled parameter for a TabPane should disable a tab #3149

davep opened this issue Aug 23, 2023 · 1 comment · Fixed by #3152
Assignees
Labels
enhancement New feature or request Task

Comments

@davep
Copy link
Contributor

davep commented Aug 23, 2023

Consider this code:

from textual.app import App, ComposeResult
from textual.widgets import TabbedContent, TabPane, Label

class DisableTabApp(App[None]):

    def compose(self) -> ComposeResult:
        with TabbedContent(id="top-level"):
            with TabPane("One", id="one", disabled=True):
                yield Label("This is tab one")
            with TabPane("Two", id="two"):
                yield Label("This is tab two")

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

Note the disabled=True on TabPane. Widgets in Textual will go into disabled mode when disabled is set to True when creating them. It would be reasonable for a developer to expect this to happen here too but currently it doesn't.

@davep davep added enhancement New feature or request Task labels Aug 23, 2023
@rodrigogiraoserrao rodrigogiraoserrao self-assigned this Aug 23, 2023
rodrigogiraoserrao added a commit that referenced this issue Aug 23, 2023
This allows one to use the 'disabled' attribute in tab panes to enable/disable a tab, which is particularly useful if you want to instantiate a tab that starts off as disabled, as seen in #3149.
@github-actions
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants