Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing text colors in MINGW64 when program runs with winpty #186

Open
chella2 opened this issue Oct 25, 2021 · 2 comments
Open

Missing text colors in MINGW64 when program runs with winpty #186

chella2 opened this issue Oct 25, 2021 · 2 comments

Comments

@chella2
Copy link

chella2 commented Oct 25, 2021

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:
image

But for programs started with winpty the text colors are missing
image

I use winpty version 0.4.3
image

Thanks!

@k-takata
Copy link

k-takata commented Oct 25, 2021

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().

@andry81
Copy link

andry81 commented Oct 25, 2021

With colorama it can work without Windows 10:

winpty python -c "from colorama import init; init(); ..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants