Files
textual/docs/examples/guide/structure.py
Will McGugan e555b8512f Default css
2022-09-02 09:56:04 +01:00

31 lines
490 B
Python

from datetime import datetime
from textual.app import App
from textual.widget import Widget
class Clock(Widget):
"""A clock app."""
DEFAULT_CSS = """
Clock {
content-align: center middle;
}
"""
def on_mount(self):
self.set_interval(1, self.refresh)
def render(self):
return datetime.now().strftime("%c")
class ClockApp(App):
def compose(self):
yield Clock()
app = ClockApp()
if __name__ == "__main__":
app.run()