def _get_height(self): if self._tty: packed = fcntl.ioctl(self._tty, termios.TIOCGWINSZ, 'xxxx') height = struct.unpack('@HH', packed)[0] else: height = 25 return height
def _get_width(self): if self._tty: packed = fcntl.ioctl(self._tty, termios.TIOCGWINSZ, 'xxxx') width = struct.unpack('@HH', packed)[1] else: width = 80 return width