Onionr/onionr/utils/getconsolewidth.py
2019-07-30 00:19:22 -05:00

15 lines
321 B
Python

import os
def get_console_width():
'''
Returns an integer, the width of the terminal/cmd window
'''
columns = 80
try:
columns = int(os.popen('stty size', 'r').read().split()[1])
except:
# if it errors, it's probably windows, so default to 80.
pass
return columns