Textual is an innovative app development framework that enables you to build sophisticated user interfaces using a simple Python API. With its decoupled components and advanced testing framework, you can maintain your apps for the long-term. Whether you're looking to create a clock app like the one shown in this example:
`python
"An App to show the current time."
from datetime import datetime
from textual.app import App, ComposeResult
from textual.widgets import Digits
class 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()
`
or want to explore other app startup ideas, Textual is the perfect choice.
Widgets and Themes
Textual's library of widgets covers everything from buttons, tree controls, data tables, inputs, text areas, and more. Combined with a flexible layout system, you can realize any user interface you need. Predefined themes ensure your apps will look good out of the box.
Installing Textual
To get started with Textual, install it via pip:
`
pip install textual textual-dev
`
See the getting started guide for details on how to use Textual.
Debugging and Command Palette
The textual-dev package supplies a dev console that connects to your application from another terminal. This makes it easy to debug your apps in the terminal. Additionally, Textual apps have a fuzzy search command palette. Hit ctrl+p to open the command palette, which can be extended with custom commands for your application.
Textual ❤️ Web
Textual apps are equally at home in the browser as they are in the terminal. Any Textual app can be served with textual serve, so you can share your creations on the web. This is especially useful for creating connected devices that don't require a desktop environment.
Join the Community
To stay up-to-date with the latest developments and connect with other Textual users, join our Discord server.
By using Textual, you can build innovative apps that run seamlessly in both the terminal and the browser. With its decoupled components, advanced testing framework, and extensive library of widgets, Textual is the perfect choice for building a wide range of apps.