Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I'm writing a terminal program and need to get the size of the TTY I'm using. The Internet seems to suggest this can be done with curses, but I can't seem to find out how in python. I'm trying to avoid using the ROWS and COLUMNS environment variables if possible :)

share|improve this question

1 Answer 1

Apparently, the getmaxyx() method is what you need. It returns a (height, width) tuple.

Python reference

Some tutorial

share|improve this answer
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – coversnail May 8 '12 at 8:07
Would expect to find this on SO, but nontheless, perfect answer, thanks! Signed up just to +1 this. :) – ArtOfWarfare Feb 9 at 20:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.