Created
June 14, 2013 18:46
-
-
Save durden/5784253 to your computer and use it in GitHub Desktop.
Get width/height of current terminal in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Snippet taken from: https://github.com/JakeWharton/pidcat/blob/master/pidcat.py | |
# unpack the current terminal width/height | |
data = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234') | |
HEIGHT, WIDTH = struct.unpack('hh',data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment