more docs

This commit is contained in:
Will McGugan
2022-05-25 15:36:58 +01:00
parent 2b485cd4cc
commit 6bfc26c1ec
43 changed files with 463 additions and 124 deletions

View File

@@ -6,7 +6,7 @@ from textual.widgets import Static
class Thing(Widget):
def render(self, style: Style):
def render(self):
return "Hello, 3434 World.\n[b]Lorem impsum."

View File

@@ -56,14 +56,14 @@ lorem_long_text = Text.from_markup(lorem * 2)
class TweetHeader(Widget):
def render(self, style: Style) -> RenderableType:
def render(self) -> RenderableType:
return Text("Lorem Impsum", justify="center")
class TweetBody(Widget):
short_lorem = Reactive[bool](False)
def render(self, style: Style) -> Text:
def render(self) -> Text:
return lorem_short_text if self.short_lorem else lorem_long_text
@@ -72,22 +72,22 @@ class Tweet(Widget):
class OptionItem(Widget):
def render(self, style: Style) -> Text:
def render(self) -> Text:
return Text("Option")
class Error(Widget):
def render(self, style: Style) -> Text:
def render(self) -> Text:
return Text("This is an error message", justify="center")
class Warning(Widget):
def render(self, style: Style) -> Text:
def render(self) -> Text:
return Text("This is a warning message", justify="center")
class Success(Widget):
def render(self, style: Style) -> Text:
def render(self) -> Text:
return Text("This is a success message", justify="center")

View File

@@ -33,7 +33,7 @@ class Introduction(Widget):
}
"""
def render(self, styles) -> RenderableType:
def render(self) -> RenderableType:
return Text("Here are the color edge types we support.", justify="center")
@@ -41,7 +41,7 @@ class BorderDemo(Widget):
def __init__(self, name: str):
super().__init__(name=name)
def render(self, style) -> RenderableType:
def render(self) -> RenderableType:
return Text(self.name, style="black on yellow", justify="center")

View File

@@ -7,7 +7,7 @@ from textual.widget import Widget
class PanelWidget(Widget):
def render(self, style: Style) -> RenderableType:
def render(self) -> RenderableType:
return Panel("hello world!", title="Title")

View File

@@ -35,7 +35,7 @@ class Introduction(Widget):
}
"""
def render(self, styles) -> RenderableType:
def render(self) -> RenderableType:
return Text(
"Press keys 0 to 9 to scroll to the Placeholder with that ID.",
justify="center",

View File

@@ -12,7 +12,7 @@ from textual.widgets.tabs import Tabs, Tab
class Hr(Widget):
def render(self, style: Style) -> RenderableType:
def render(self) -> RenderableType:
return Rule()
@@ -23,7 +23,7 @@ class Info(Widget):
super().__init__()
self.text = text
def render(self, style: Style) -> RenderableType:
def render(self) -> RenderableType:
return Padding(f"{self.text}", pad=(0, 1))