I am writing a Python script to print out displayable user interface. The problem is every Linux user would have their own unique terminal size. This will cause the hard-coded user interface to go out of format.
(If there is a lot of example below, the terminal looks Crazy!!!).
Example, in the script. I have print out:
print "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
Format should goes well in my terminal: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
When the terminal is smaller, the print out format will run out. Format become: ++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++
So I am thinking:
- When the user run the script, can I auto change the Linux terminal size to my declare size
- Can I get the Width and Length of the user terminal size using Python, so the terminal display can be flexible
- I would like to hear any better solution around the world to solve the terminal display problem!
I would strongly prefer recommendation in Python