Comment 6 for bug 3507

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

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]