How to get terminal width?

Doug Stanfield DOUGS at oceanic.com
Wed May 3 04:42:17 EDT 2000


Assuming you're on a *nix platform, there is an environmental variable,
COLUMNS, that should be accessible.  If you use curses there is a
stdscr.getmaxyx() function.

-Doug-

> -----Original Message-----
> From: cpmcda01 at shark.kitenet.net [mailto:cpmcda01 at shark.kitenet.net]
> Sent: Tuesday, May 02, 2000 1:45 PM
> To: python-list at python.org
> Subject: How to get terminal width?
> 
> 
> 
> I need to write a command line script in Python that needs to 
> know the width
> of the terminal in characters. I've looked through several modules and
> haven't yet found what I'm looking for. Does anyone know 
> where I need to
> look?
> 
> 
> -- 
> Later,
> _) Craig McDaniel
> _)_) craig at tool.net
> _)_)_) cpmcda01 at slug.louisville.edu
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list