Here is the code I use in Smart PM:
def get_screen_width(): s = struct.pack('HHHH', 0, 0, 0, 0) try: x = fcntl.ioctl(1, termios.TIOCGWINSZ, s) except IOError: return 80 return struct.unpack('HHHH', x)[1]
Here is the code I use in Smart PM:
def get_screen_width(): unpack( 'HHHH', x)[1]
s = struct.pack('HHHH', 0, 0, 0, 0)
try:
x = fcntl.ioctl(1, termios.TIOCGWINSZ, s)
except IOError:
return 80
return struct.