Выводим текст в цветном виде в консольных приложениях для Windows на Python. 1 способ.
Просто импортируем модуль color_console.py в нашу программу. В архиве сам модуль color_console.py и примеры для Python 2.6 и Python 3.
2 способ.Набираем в консоли: #-*- coding: utf-8 -*- from ctypes import * windll.Kernel32.GetStdHandle.restype = c_ulong h = windll.Kernel32.GetStdHandle(c_ulong(0xfffffff5)) color = 0 while color < 16: windll.Kernel32.SetConsoleTextAttribute(h, color) print ("color number: {0}".format( color )) color += 1 
|