On 2019-01-14, Peter Otten <__pete...@web.de> wrote: > Grant Edwards wrote: > > os.environ["COLUMNS"] > >> [...] will tell you the terminal size at the time Python was started. > > I admit that none of my scripts is ambitious enough to try and track > changes in terminal size. > > But still, Grant's post prompted me to reread the doc and source of > shutil.get_terminal_size(), and I think I should warn you that the > environment variables take precedence over ioctl()-based detection > in os.get_terminal_size().
For non-interactive programs, the environment variable approach is usually good enough. For interactive programs you use ncurses, slang, newt, or somesuch library, and they deal with tracking the window size for you (mostly). -- Grant Edwards grant.b.edwards Yow! My haircut is totally at traditional! gmail.com -- https://mail.python.org/mailman/listinfo/python-list