[Tutor] clearing lines for a 'front end' to a tool

Alan Gauld alan.gauld at btinternet.com
Thu Sep 18 02:27:40 CEST 2008


"James" <jtp at nc.rr.com> wrote

> Thanks for the response. As a personal opinion, do you find it more
> appropriate to use something like curses (since it's already built
> into the standard Python library), or to use something "third party"
> like urwid?

urwid is just a wrapper around curses.
curses is the standard for doing text mode interfaces that go beyond
simple printing of lines.

Its not difficult to learn basic curses, it is slightly different to a
GUI but not so very different. And there are loads of online
tutorials and examples and even an O'Reilly book you can buy.
Translating a C curses tuttor to Python is pretty self evident
since most curses programs consist of sequences of curses
calls with very little else. Those curses calls are identical in 
Python.

> This program will be distributed to lots of individuals that will
> likely not have urwid installed right off the bat.

If they are on *nix they will have curses installed.
If they are on Windows they almost certainly won't!

> I find the Python curses documentation to be...lacking at best. ;)

It assumes you know curses basics.
Try here:

http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/index.html

for a fairly comprehensive course.

> Thus the only benefit I see to curses over urwid is that it is 
> already
> "built-in" to Python.

And just about every other programming language around.
Its the lowest common denominator, very much like Tk is a
common GUI framework, learn it in Tkinter and you can very
quickly program GUIs in Ruby, Perl, C, etc... Similarly with
curses, if you learn it you can code a text UI in virtually any
popular language.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list