Textual Development Tools

1.8.0 · active · verified Tue Apr 14

textual-dev is a Python library that provides command-line utilities and a development console to aid in building and debugging Textual TUI applications. It is released alongside the main Textual framework, which typically has a rapid release cadence, often weekly or bi-weekly for minor versions. The current version is 1.8.0.

Warnings

Install

Quickstart

To use textual-dev, first save the provided Python code as `my_app.py`. Then, open *two separate terminal windows*. In the first terminal, start the Textual development console. In the second, run your application in development mode, enabling it to connect to the console. This setup allows you to see logs, debug information, and perform live editing tasks. Terminal 1: ```bash pip install textual textual-dev textual console ``` Terminal 2: ```bash python my_app.py --dev # or, if textual is installed in path: # textual run --dev my_app.py ```

import os
from textual.app import App, ComposeResult
from textual.widgets import Header, Footer, Static

# --- Save this as my_app.py ---
class MyApp(App):
    BINDINGS = [("d", "toggle_dark", "Toggle dark mode")]

    def compose(self) -> ComposeResult:
        yield Header()
        yield Static("Hello, Textual Devtools!", id="hello")
        yield Footer()

    def action_toggle_dark(self) -> None:
        self.dark = not self.dark

if __name__ == "__main__":
    app = MyApp()
    app.run()

view raw JSON →