Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/textualize/textual
The lean application framework for Python. Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal and a web browser.
https://github.com/textualize/textual
cli framework python rich terminal tui
Last synced: 6 days ago
JSON representation
The lean application framework for Python. Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal and a web browser.
- Host: GitHub
- URL: https://github.com/textualize/textual
- Owner: Textualize
- License: mit
- Created: 2021-04-08T15:24:47.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-14T16:36:42.000Z (7 days ago)
- Last Synced: 2024-12-14T23:25:16.607Z (7 days ago)
- Topics: cli, framework, python, rich, terminal, tui
- Language: Python
- Homepage: https://textual.textualize.io/
- Size: 405 MB
- Stars: 26,096
- Watchers: 163
- Forks: 809
- Open Issues: 185
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Roadmap: docs/roadmap.md
Awesome Lists containing this project
- awesome-ChatGPT-repositories - textual - Textual is a Rapid Application Development framework for Python. Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal and (coming soon) a web browser! (Browser-extensions)
README
[![Discord](https://img.shields.io/discord/1026214085173461072)](https://discord.gg/Enf6Z3qhVr)
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/textual/1.0.0)](https://pypi.org/project/textual/)
[![PyPI version](https://badge.fury.io/py/textual.svg?)](https://badge.fury.io/py/textual)
![OS support](https://img.shields.io/badge/OS-macOS%20Linux%20Windows-red)![textual-splash](https://github.com/user-attachments/assets/4caeb77e-48c0-4cf7-b14d-c53ded855ffd)
# Textual
Build cross-platform user interfaces with a simple Python API. Run your apps in the terminal *or* a web browser.
Textual's API combines modern Python with the best of developments from the web world, for a lean app development experience.
De-coupled components and an advanced [testing](https://textual.textualize.io/guide/testing/) framework ensure you can maintain your app for the long-term.Want some more examples? See the [examples](https://github.com/Textualize/textual/tree/main/examples) directory.
```python
"""
An App to show the current time.
"""from datetime import datetime
from textual.app import App, ComposeResult
from textual.widgets import Digitsclass ClockApp(App):
CSS = """
Screen { align: center middle; }
Digits { width: auto; }
"""def compose(self) -> ComposeResult:
yield Digits("")def on_ready(self) -> None:
self.update_clock()
self.set_interval(1, self.update_clock)def update_clock(self) -> None:
clock = datetime.now().time()
self.query_one(Digits).update(f"{clock:%T}")if __name__ == "__main__":
app = ClockApp()
app.run()
```> [!TIP]
> Textual is an asynchronous framework under the hood. Which means you can integrate your apps with async libraries — if you want to.
> If you don't want or need to use async, Textual won't force it on you.## Widgets
Textual's library of [widgets](https://textual.textualize.io/widget_gallery/) covers everything from buttons, tree controls, data tables, inputs, text areas, and more…
Combined with a flexible [layout](https://textual.textualize.io/how-to/design-a-layout/) system, you can realize any User Interface you need.Predefined themes ensure your apps will look good out of the box.
![buttons](https://github.com/user-attachments/assets/2ac26387-aaa3-41ed-bc00-7d488600343c)
![tree](https://github.com/user-attachments/assets/61ccd6e9-97ea-4918-8eda-3ee0f0d3770e)
![datatables](https://github.com/user-attachments/assets/3e1f9f7a-f965-4901-a114-3c188bd17695)
![inputs](https://github.com/user-attachments/assets/b02aa203-7c37-42da-a1bb-2cb244b7d0d3)
![listview](https://github.com/user-attachments/assets/963603bc-aa07-4688-bd24-379962ece871)
![textarea](https://github.com/user-attachments/assets/cd4ba787-5519-40e2-8d86-8224e1b7e506)
## Installing
Install Textual via pip:
```
pip install textual textual-dev
```See [getting started](https://textual.textualize.io/getting_started/) for details.
## Demo
Run the following command to see a little of what Textual can do:
```
python -m textual
```Or try the [textual demo](https://github.com/textualize/textual-demo) *without* installing (requires [uv](https://docs.astral.sh/uv/)):
```bash
uvx --python 3.12 textual-demo
```## Dev Console
How do you debug an app in the terminal that is also running in the terminal?
The `textual-dev` package supplies a dev console that connects to your application from another terminal.
In addition to system messages and events, your logged messages and print statements will appear in the dev console.See [the guide](https://textual.textualize.io/guide/devtools/) for other helpful tools provided by the `textual-dev` package.
## Command Palette
Textual apps have a *fuzzy search* command palette.
Hit `ctrl+p` to open the command palette.It is easy to extend the command palette with [custom commands](https://textual.textualize.io/guide/command_palette/) for your application.
![Command Palette](https://github.com/user-attachments/assets/94d8ec5d-b668-4033-a5cb-bf820e1b8d60)
# Textual ❤️ Web
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.
Here's how to serve the demo app:```
textual serve "python -m textual"
```In addition to serving your apps locally, you can serve apps with [Textual Web](https://github.com/Textualize/textual-web).
Textual Web's firewall-busting technology can serve an unlimited number of applications.
Since Textual apps have low system requirements, you can install them anywhere Python also runs. Turning any device in to a connected device.
No desktop required!## Join us on Discord
Join the Textual developers and community on our [Discord Server](https://discord.gg/Enf6Z3qhVr).