ANN: a portable text console user interface

J.Jacob joost_jacob at hotmail.com
Sun May 12 12:45:43 EDT 2002


I put module textui in the public domain on parnassus
http://py.vaults.ca/apyllo.py?i=15871892
You can get it at:
http://www.liacs.nl/~jjacob/textui.py

Module textui is for people like me who did use Turbo Pascal, and who
want to program text-based user-interfaces with writeln() and readln()
and their friends.

An example program:
--------------------------------------------------
from textui import *

makewindow()    # default size is 40x20 characters
name = read('Enter your name: ')
writeln(' ... done')
write('hello '+name)

# display a box with name in it
boxstring = '#'*len(name) + '####'
writeln(boxstring, x=4, y=4)
writeln('# '+name+' #', x=4)
write(boxstring, x=4)

resize()        # make the window just big enough
mainloop()      # catch events (stay alive)
--------------------------------------------------

It has other methods like clear() and scroll() and resize().
But the fun thing is you can get to the underlying Tkinter widget for
sophisticated stuff, for example when you want color which is not
implemented in the textui.functions.  You can also use that Tkinter
widget in your 'big' Tkinter application.

When run as an application the textui module shows a demo.



More information about the Python-list mailing list