Python like the old-time batch files.

Peter Hansen peter at engcorp.com
Fri Feb 1 02:14:48 CET 2002


Chris Gonnerman wrote:
> 
> "MDK" <mdk at mdk.com> wrote:
> > In Windows when I double click on a Python.py file it runs in a DOS-like
> > box.  Is it possible in Python to make those neat double-line borders,
> > change colors, and move the cursor to the exact position you want?
> 
> The borders I'm not sure about, but my WConio module can handle the rest.
> 
>     http://newcenturycomputers.net/projects/wconio.html
> 
> If anyone knows about drawing lines and boxes in a Windows Console and
> is willing to illuminate me, I'll add support to WConio for that also.

Boxes are formed from lines, and the lines are just special graphic 
characters from the IBM PC Extended ASCII Display Characters as shown 
in, for example, http://www.jimprice.com/jim-asc.htm .

For example, the following outputs a trivial, fixed-size box at the
current location:

>>> WConio.cputs('\xDA\xC4\xC4\xC4\xBF\n\xC0\xC4\xC4\xC4\xD9')
+---+
+---+>>>

(Yes, that looks better on in the DOS prompt... :)

I'd recommend not adding it to WConio, since it is relatively 
simple to do as needed, and is not itself sufficient for much
improvement over a basic text interface, so it would likely 
grow over time and overload WConio with mostly unused 
functionality.  A new module on top of WConio might be a better
option.

-Peter



More information about the Python-list mailing list