home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- __author__ = 'Alexander Belchenko (e-mail: bialix AT ukr.net)'
- __license__ = 'Public domain'
- import struct
-
- try:
- import ctypes
- except ImportError:
- ctypes = None
-
-
- def get_console_size(defaultx = 80, defaulty = 25):
- if ctypes is None:
- return (defaultx, defaulty)
- h = ctypes.windll.kernel32.GetStdHandle(-11)
- csbi = ctypes.create_string_buffer(22)
- res = ctypes.windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
- if res:
- (bufx, bufy, curx, cury, wattr, left, top, right, bottom, maxx, maxy) = struct.unpack('hhhhHhhhhhh', csbi.raw)
- sizex = (right - left) + 1
- sizey = (bottom - top) + 1
- return (sizex, sizey)
- return (defaultx, defaulty)
-
-