RahulShaw / LinuxAcademy-DL

Download videos from your LinuxAcademy account for offline viewing
MIT License
65 stars 44 forks source link

ANSI Escape characters not coloring on CMD terminal on Windows 10 #49

Open niranjan23d opened 3 years ago

niranjan23d commented 3 years ago

Although Windows 10 TH2 (v1511) added support for ANSI escape sequences, colors still do not show up on the terminal; the reason is that the feature must be enabled/utilized by the program accessing the terminal.

The check mark sign also appears as a question mark within a box.

Here is my solution to the problem:

  1. For the check mark, I modified the string and entered the sqrt symbol - u"\u221A" OR by holding ALT + 251 (numpad).
  2. For colored output, I just used this snippet from Stackoverflow. Rahul, you could make it so that this works if driver.py detects if it is a Windows system only.
    
    import ctypes

kernel32 = ctypes.windll.kernel32 kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)



Windows working proof:
![image](https://user-images.githubusercontent.com/16829611/92537376-92ccb600-f201-11ea-9526-c0f02daaa5c0.png)
RahulShaw commented 3 years ago

Okay, noted!