Get the height and width of the console. Returns: - tuple: Height and width of the console.
(self)
| 441 | if TIOCGWINSZ: |
| 442 | |
| 443 | def getheightwidth(self): |
| 444 | """ |
| 445 | Get the height and width of the console. |
| 446 | |
| 447 | Returns: |
| 448 | - tuple: Height and width of the console. |
| 449 | """ |
| 450 | try: |
| 451 | return int(os.environ["LINES"]), int(os.environ["COLUMNS"]) |
| 452 | except (KeyError, TypeError, ValueError): |
| 453 | try: |
| 454 | size = ioctl(self.input_fd, TIOCGWINSZ, b"\000" * 8) |
| 455 | except OSError: |
| 456 | return 25, 80 |
| 457 | height, width = struct.unpack("hhhh", size)[0:2] |
| 458 | if not height: |
| 459 | return 25, 80 |
| 460 | return height, width |
| 461 | |
| 462 | else: |
| 463 |
no test coverage detected