mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
more docs
This commit is contained in:
@@ -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."
|
||||
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user