Docstrings

This commit is contained in:
Darren Burns
2024-07-30 13:43:20 +01:00
parent bd93bb77f5
commit a5035ac29e

View File

@@ -4,12 +4,15 @@ from textual.widgets import Button
class OpenLink(App[None]):
"""Demonstrates opening a URL in the same tab or a new tab."""
def compose(self) -> ComposeResult:
yield Button("Visit the Textual docs", id="open-link-same-tab")
yield Button("Visit the Textual docs in a new tab", id="open-link-new-tab")
@on(Button.Pressed)
def open_link(self, event: Button.Pressed) -> None:
"""Open the URL in the same tab or a new tab depending on which button was pressed."""
self.open_url(
"https://textual.textualize.io",
new_tab=event.button.id == "open-link-new-tab",