Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
✨ Example for Textualize/textual#4233
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Feb 28, 2024
1 parent 4d8c3dd commit d6ae87d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tabbed_content_message_stealing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Example for https://github.com/Textualize/textual/issues/4233"""

from textual import on
from textual.app import App, ComposeResult
from textual.widgets import Button, TabbedContent, TabPane, Tabs


class TabbedContentMessageStealingApp(App[None]):
CSS = """
TabbedContent, TabPane {
height: 1fr;
width: 1fr;
}
"""

def compose(self) -> ComposeResult:
with TabbedContent():
with TabPane("Test", id="avoid-me"):
yield Button("Disable", id="disable")
yield Tabs("One", "Two", "Three", id="test-tabs")

@on(Button.Pressed, "#disable")
def disable_test(self) -> None:
self.query_one("#test-tabs", Tabs).disable("tab-1")


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

### tabbed_content_message_stealing.py ends here

0 comments on commit d6ae87d

Please sign in to comment.