Skip to content
NSPC911 edited this page Jun 7, 2026 · 3 revisions

textual-drivers

Drop-in subclasses of Textual's built-in terminal drivers with two extra capabilities:

Capability Summary
lock_stdin Pause the driver's stdin thread and silence terminal events — lets you run terminal queries or subprocesses without interference
register_event_handler Bind a pattern against raw stdin; when it matches, a Message is posted into Textual's event system

A higher-level DNDApp base class builds on these to implement the full kitty drag-and-drop protocol (drag-in and drag-out).

Installation

uv add textual-drivers

Or with pip:

pip install textual-drivers

Quick start

import sys
from textual.app import App, ComposeResult
from textual.widgets import Label
from textual_drivers import DrivenApp

class MyApp(DrivenApp):
    def compose(self) -> ComposeResult:
        yield Label("Hello!")

MyApp().run()

DrivenApp picks the right platform driver automatically. See Drivers for manual driver selection and mixin usage.

Pages

  • Drivers — driver classes, DrivenApp, and using the mixin in your own driver
  • lock-stdin — exclusive stdin ownership for terminal queries and subprocesses
  • register-event-handler — pattern-based raw stdin → Textual message routing
  • DnD — kitty drag-and-drop protocol via DNDApp

Clone this wiki locally