Fix
This commit is contained in:
parent
b527fb2add
commit
0c9926e2dd
27
text.py
27
text.py
@ -1,21 +1,16 @@
|
||||
from textual.app import App
|
||||
from textual.widgets import ScrollView, TabView, Tab
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.widgets import TabbedContent, TabPane, TextArea
|
||||
|
||||
class SimpleCLITool(App):
|
||||
async def on_mount(self):
|
||||
# Create TabView with two tabs
|
||||
tabs = TabView(
|
||||
tabs=[
|
||||
Tab("First Tab", content=ScrollView(auto_width=True)),
|
||||
Tab("Second Tab", content=ScrollView(auto_width=True))
|
||||
]
|
||||
)
|
||||
def compose(self) -> ComposeResult:
|
||||
# Create TabbedContent with two tabs
|
||||
yield TabbedContent() as tc:
|
||||
# First Tab
|
||||
with TabPane("First Tab"):
|
||||
yield TextArea("This is the content of the first tab. " * 10, auto_width=True)
|
||||
|
||||
# Update content for each tab
|
||||
tabs.tabs[0].content.update("This is the content of the first tab. " * 10)
|
||||
tabs.tabs[1].content.update("This is the content of the second tab. " * 10)
|
||||
|
||||
# Dock the tabs into the app's view
|
||||
await self.view.dock(tabs)
|
||||
# Second Tab
|
||||
with TabPane("Second Tab"):
|
||||
yield TextArea("This is the content of the second tab. " * 10, auto_width=True)
|
||||
|
||||
SimpleCLITool.run(log="textual.log")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user