← Back to All Frameworks

Urwid

Powerful and flexible library for creating console user interfaces

Overview

Urwid is a flexible and comprehensive Python library used to create text-based user interfaces for terminal applications. It enables developing console applications with rich user interactivity and custom layouts.

Key Features:

  • Rich set of widgets for building custom UI
  • Supports styles and themes
  • Responsive layout management
  • Input handling for mouse and keyboard
  • Designed for dynamic changes and animations

Common Use Cases:

  • Text-based consoles and dashboards
  • System monitoring tools
  • CLI utilities requiring a UI
  • Interactive terminal applications
  • Embedded systems with TUI requirements

Installation

pip install urwid

Example

import urwid

def on_exit(key):
    if key == 'q':
        raise urwid.ExitMainLoop()

txt = urwid.Text("Hello, Urwid!", align='center')
fill = urwid.Filler(txt, valign='middle')
loop = urwid.MainLoop(fill, unhandled_input=on_exit)
loop.run()