posix.get_terminal_size
Prev: posix.get_inheritable | Up: posix | Next: posix.getcwd
Rel: posix.abort, posix.access, posix.chdir, posix.chflags
Ref: docs.python.org — posix.get_terminal_size
Tags: #public #python3 #stdlib #posix
Import
import posix
from posix import get_terminal_size
Signature & Overview
posix.get_terminal_size(...)
Return the size of the terminal window as (columns, lines).
Usage
import shutil
# Prefer shutil.get_terminal_size() which falls back safely when piped
sz = shutil.get_terminal_size((80, 24))
assert sz.columns > 0
Gotchas
os.get_terminal_size()raisesOSErrorwhen stdout is redirected.
REPL Inspect
from posix import get_terminal_size
help(get_terminal_size)
Linked from
Related notes
- tuts/python3/stdlib_module/posix/get_inheritable Linked here; links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/getcwd Linked here; links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/posix/abort Linked here; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/access Linked here; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chdir Linked here; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chflags Linked here; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chmod shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chown shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chroot shared tags: #posix, #stdlib