LWN.net Logo

Urwid, a Console UI library for Python

Urwid is a terminal-based user interface library for the Python language that is reminiscent of the old Unix curses terminal control library. Urwid is used for implementing user interfaces that work with simple ASCII terminals.

[Urwid] The basic Urwid feature set includes:

  • A list box mechanism with support for scrolling.
  • An edit box for entering and modifying text.
  • Pushbutton, check box, and radio button widgets.
  • Simple character-style graphical capabilities.
  • The ability to adapt to a dynamically resizeable terminal window.
  • Support for capturing the screen.
  • Support for embedded tables of widgets.
  • Support for UTF-8, 8 bit ASCII, and other character encodings.
  • Includes a text attribute markup language.
  • Support for multiple text alignment and line wrapping modes.
  • Support for user-defined text layout classes.
  • Support for a web-based Apache/CGI display mode.
  • Runs on Linux, OSX, Cygwin-based, and other systems.
Urwid documentation is thorough, an online Reference Manual explains the programming interface and the online Tutorial gives some example uses of the software.

There is also an online web_display module live demo site for those who wish to test Urwid in action.

Installation is quite simple, packages are available for Debian-based systems, and a simple setup.py script is provided for other platforms. A number of useful demo programs are included for testing and reference. Demos include a directory browser, a numerical calculator, a text editor, a test suite, a fibonacci generator and a package tour, see the screenshot and programming examples for some images. Your author was able to run all of the demos with no trouble.

Version 0.9.0 of Urwid was released this week: "This is the first release of Urwid with UTF-8 input and display support. A new raw_display module was added to enable UTF-8 display. This module also fixes the "dead corner" in the bottom right of the screen and improves legibility of bright text in some terminals."

Urwid is a useful tool for applications that need the portability offered by a text-only user interface, it fills a void between full-fledged GUI applications and a simple command line interface. Being Python-based, it is portable, easy to install, and simple to use.


(Log in to post comments)

Urwid, a Console UI library for Python

Posted Feb 24, 2006 14:52 UTC (Fri) by hazelsct (guest, #3659) [Link]

What would be cool is a widget for embedding GStreamer aalib output so terminal apps can display DVDs, video input (V4L), or general video playback!

Urwid, a Console UI library for Python

Posted Feb 24, 2006 15:42 UTC (Fri) by Webexcess (subscriber, #197) [Link]

It shouldn't be too hard to add. You just have to wrap aalib (or perhaps use the ctypes module) and convert its output to a canvas that Urwid can display.

I'd be glad to help with the latter part. A console video player with a seek bar, pause/play/stop buttons and subtitles would have major geek-appeal :-)

Urwid, a Console UI library for Python

Posted Feb 24, 2006 17:33 UTC (Fri) by hazelsct (guest, #3659) [Link]

Wow, I posted this half-joking, and don't quite have the time now, but would be glad to sink some time into this in a month or two. Hmm, have to learn some details of how aalib and console "graphics" work, could take some time, but yes, major geek appeal.

Thanks for the offer to work on this. I'm reachable at hazelscq at debian dot org, change q to t.

Urwid, a Console UI library for Python

Posted Mar 2, 2006 12:00 UTC (Thu) by leandro (guest, #1460) [Link]

What would be really nice was a text version of, say, Gtk+ or wxWindows widgets, a là Oracle Forms or MS Visual BASIC for MS-DOS: the possibility of compiling the same app for either a GUI or a full-screen terminal.

Copyright © 2006, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds