OLD | NEW |
1 | 1 # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. |
2 from . import win32 | 2 from . import win32 |
3 | 3 |
4 | 4 |
5 # from wincon.h | 5 # from wincon.h |
6 class WinColor(object): | 6 class WinColor(object): |
7 BLACK = 0 | 7 BLACK = 0 |
8 BLUE = 1 | 8 BLUE = 1 |
9 GREEN = 2 | 9 GREEN = 2 |
10 CYAN = 3 | 10 CYAN = 3 |
11 RED = 4 | 11 RED = 4 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return | 106 return |
107 handle = win32.STDOUT | 107 handle = win32.STDOUT |
108 if on_stderr: | 108 if on_stderr: |
109 handle = win32.STDERR | 109 handle = win32.STDERR |
110 # here's where we'll home the cursor | 110 # here's where we'll home the cursor |
111 coord_screen = win32.COORD(0,0) | 111 coord_screen = win32.COORD(0,0) |
112 csbi = win32.GetConsoleScreenBufferInfo(handle) | 112 csbi = win32.GetConsoleScreenBufferInfo(handle) |
113 # get the number of character cells in the current buffer | 113 # get the number of character cells in the current buffer |
114 dw_con_size = csbi.dwSize.X * csbi.dwSize.Y | 114 dw_con_size = csbi.dwSize.X * csbi.dwSize.Y |
115 # fill the entire screen with blanks | 115 # fill the entire screen with blanks |
116 win32.FillConsoleOutputCharacter(handle, ord(' '), dw_con_size, coord_sc
reen) | 116 win32.FillConsoleOutputCharacter(handle, ' ', dw_con_size, coord_screen) |
117 # now set the buffer's attributes accordingly | 117 # now set the buffer's attributes accordingly |
118 win32.FillConsoleOutputAttribute(handle, self.get_attrs(), dw_con_size,
coord_screen ); | 118 win32.FillConsoleOutputAttribute(handle, self.get_attrs(), dw_con_size,
coord_screen ); |
119 # put the cursor at (0, 0) | 119 # put the cursor at (0, 0) |
120 win32.SetConsoleCursorPosition(handle, (coord_screen.X, coord_screen.Y)) | 120 win32.SetConsoleCursorPosition(handle, (coord_screen.X, coord_screen.Y)) |
OLD | NEW |