Functions | |
None | _SetVTMode () |
If we are on Windows (as indicated by the presence of the Kernel32 DLL), set the virtual terminal processing flag on the standard output for the Windows Console. | |
None | _RestoreVTMode () |
If we are on Windows (as indicated by the presence of the Kernel32 DLL), restore the standard output mode for the Windows Console. | |
def | EnableVTMode (callable function) |
Wrap the given function with enabling and disabling the virtual terminal processing for a Windows Console. | |
Variables | |
int | STD_OUTPUT_HANDLE = -11 |
Value representing the Standard Output Handle in the Windows Console. | |
int | ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 |
Flag that, when set, enables virtual terminal processing and thus support for ANSI escape code handling. | |
None | originalConsoleMode = None |
Holds the original mode for Standard Output in the Windows Console so it can be restored later on. | |
try : | |
ctypes | kernel32 = ctypes.windll.kernel32 |
except : | |
|
protected |
If we are on Windows (as indicated by the presence of the Kernel32 DLL), restore the standard output mode for the Windows Console.
Definition at line 52 of file enablevtmode.py.
Referenced by DesignPatternExamples_python.enablevtmode.EnableVTMode().
|
protected |
If we are on Windows (as indicated by the presence of the Kernel32 DLL), set the virtual terminal processing flag on the standard output for the Windows Console.
Definition at line 39 of file enablevtmode.py.
Referenced by DesignPatternExamples_python.enablevtmode.EnableVTMode().
def EnableVTMode | ( | callable | function | ) |
Wrap the given function with enabling and disabling the virtual terminal processing for a Windows Console.
The processing is disabled regardless of the exit state of the function.
This is generally intended to wrap a main() function like this:
Definition at line 66 of file enablevtmode.py.
References DesignPatternExamples_python.enablevtmode._RestoreVTMode(), and DesignPatternExamples_python.enablevtmode._SetVTMode().
int ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 |
Flag that, when set, enables virtual terminal processing and thus support for ANSI escape code handling.
Definition at line 21 of file enablevtmode.py.
except : |
Definition at line 32 of file enablevtmode.py.
None kernel32 = ctypes.windll.kernel32 |
Definition at line 31 of file enablevtmode.py.
None originalConsoleMode = None |
Holds the original mode for Standard Output in the Windows Console so it can be restored later on.
Definition at line 25 of file enablevtmode.py.
int STD_OUTPUT_HANDLE = -11 |
Value representing the Standard Output Handle in the Windows Console.
Definition at line 18 of file enablevtmode.py.
try : |
Definition at line 29 of file enablevtmode.py.