15 lines
321 B
Python
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
|