hey guys.....i need for a part of my homework in python...to change the text in color. for each letter a specific color will be assigned, in this way, the text that will be typed in will be turned into the specific color. can anybody help me?

Recommended Answers

All 5 Replies

Are you printing your text in a GUI widget or in a console ? also what is your OS and version of python ?

OS win 7 ... python 0.61 ... in a console

OS win 7 ... python 0.61 ... in a console

Then you should perhaps start by reading this http://www.burgaud.com/bring-colors-to-the-windows-console-with-python/ . There is also a small module for download.

I also know that it's not the only method to print in colors with the cmd console, but I don't usually use windows, so I can't say more.

Edit: what is this python 0.61 ?

it`s a retarded version that we work @ school with...it`s kind of changed by our prof. :|

Following a link in the comments of the previous link, I discovered this module colorama http://pypi.python.org/pypi/colorama which allows interpretation of the ANSI escape sequences in the windows cmd. This allows cross-platform colored text in a console !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.