You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build cross-platform user interfaces with a simple Python API. Run your apps in the terminal *or* a web browser.
17
17
18
+
Textual's API combines modern Python with the best of developments from the web world, for a lean app development experience.
19
+
De-coupled components and an advanced [testing](https://textual.textualize.io/guide/testing/) framework ensure you can maintain your app for the long-term.
20
+
21
+
Want some more examples? See the [examples](https://github.com/Textualize/textual/tree/main/examples) directory.
22
+
23
+
```python
24
+
"""
25
+
An App to show the current time.
26
+
"""
27
+
28
+
from datetime import datetime
29
+
30
+
from textual.app import App, ComposeResult
31
+
from textual.widgets import Digits
32
+
33
+
34
+
classClockApp(App):
35
+
CSS="""
36
+
Screen { align: center middle; }
37
+
Digits { width: auto; }
38
+
"""
39
+
40
+
defcompose(self) -> ComposeResult:
41
+
yield Digits("")
42
+
43
+
defon_ready(self) -> None:
44
+
self.update_clock()
45
+
self.set_interval(1, self.update_clock)
46
+
47
+
defupdate_clock(self) -> None:
48
+
clock = datetime.now().time()
49
+
self.query_one(Digits).update(f"{clock:%T}")
50
+
51
+
52
+
if__name__=="__main__":
53
+
app = ClockApp()
54
+
app.run()
55
+
```
56
+
57
+
> [!TIP]
58
+
> Textual is an asynchronous framework under the hood. Which means you can integrate your apps with async libraries — if you want to.
59
+
> If you don't want or need to use async, Textual won't force it on you.
Textual apps are equally at home in the browser as they are the terminal. Any Textual app may be served with `textual serve`— so you can share your creations on the web.
118
192
Here's how to serve the demo app:
119
193
120
194
```
121
195
textual serve "python -m textual"
122
196
```
123
197
124
-
In addition to serving your apps locally, you can serve apps with [Textual-Web](https://github.com/Textualize/textual-web).
198
+
In addition to serving your apps locally, you can serve apps with [TextualWeb](https://github.com/Textualize/textual-web).
125
199
126
200
Textual Web's firewall-busting technology can serve an unlimited number of applications.
127
201
128
202
Since Textual apps have low system requirements, you can install them anywhere Python also runs. Turning any device in to a connected device.
129
203
No desktop required!
130
204
131
-
## Documentation
132
205
133
-
Head over to the [Textual documentation](http://textual.textualize.io/) to start building.
0 commit comments