Show More
@@ -16,7 +16,7 b' used.' | |||
|
16 | 16 | import win32api |
|
17 | 17 | |
|
18 | 18 | import errno, os, sys, pywintypes, win32con, win32file, win32process |
|
19 | import winerror, win32gui | |
|
19 | import winerror, win32gui, win32console | |
|
20 | 20 | import osutil, encoding |
|
21 | 21 | from win32com.shell import shell, shellcon |
|
22 | 22 | |
@@ -189,3 +189,16 b' def hidewindow():' | |||
|
189 | 189 | |
|
190 | 190 | pid = win32process.GetCurrentProcessId() |
|
191 | 191 | win32gui.EnumWindows(callback, pid) |
|
192 | ||
|
193 | def termwidth_(): | |
|
194 | try: | |
|
195 | # Query stderr to avoid problems with redirections | |
|
196 | screenbuf = win32console.GetStdHandle(win32console.STD_ERROR_HANDLE) | |
|
197 | try: | |
|
198 | window = screenbuf.GetConsoleScreenBufferInfo()['Window'] | |
|
199 | width = window.Right - window.Left | |
|
200 | return width | |
|
201 | finally: | |
|
202 | screenbuf.Detach() | |
|
203 | except pywintypes.error: | |
|
204 | return 79 |
General Comments 0
You need to be logged in to leave comments.
Login now