This repository has been archived by the owner on Jun 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Example for Textualize/textual#4233
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |