Add easing example app, restructure dirs a little

This commit is contained in:
Darren Burns
2022-09-01 16:09:41 +01:00
parent c76594409c
commit e354ed142a
5 changed files with 39 additions and 1 deletions

View File

@@ -172,6 +172,14 @@ def run_app(import_name: str, dev: bool, press: str) -> None:
@run.command("borders")
def borders():
"""Explore the border styles available in Textual."""
from ..devtools import borders
from textual.cli.previews import borders
borders.app.run()
@run.command("easing")
def easing():
"""Explore the animation easing functions available in Textual."""
from textual.cli.previews import easing
easing.app.run()

View File

View File

@@ -0,0 +1,8 @@
EasingButtons > Button {
width: 100%;
}
EasingButtons {
dock: left;
width: 20;
overflow: auto auto;
}

View File

@@ -0,0 +1,22 @@
from textual._easing import EASING
from textual.app import ComposeResult, App
from textual.widget import Widget
from textual.widgets import Button, Static
class EasingButtons(Widget):
def compose(self) -> ComposeResult:
for easing in EASING:
yield Button(easing)
class EasingApp(App):
def compose(self) -> ComposeResult:
yield EasingButtons()
self.text = Static("Easing examples")
yield self.text
app = EasingApp(css_path="easing.css", watch_css=True)
if __name__ == "__main__":
app.run()