winpty
winpty copied to clipboard
Missing text colors in MINGW64 when program runs with winpty
Hi,
I use MINGW64 and wonder how to get colored text output from programs started with winpty
.
Example:
Colored text works when program is not using winpty:
But for programs started with winpty the text colors are missing
I use winpty version 0.4.3
Thanks!
Try this:
$ winpty python -c "from ctypes import *; windll.kernel32.SetConsoleMode(windll.kernel32.GetStdHandle(-11), 7); print('\033[32mGreen\033[m')"
For detail, see the ENABLE_VIRTUAL_TERMINAL_PROCESSING
flag of SetConsoleMode().
With colorama it can work without Windows 10:
winpty python -c "from colorama import init; init(); ..."