Hello every1,

I've been googling about but can't seem to find a solution to the following problem:

print "Hello world"

How does one colourize the "Hello world" in the results. It can be any colour as long as it's not the standard blue. Also I need to know what is the range of the colours availabe in Tkinter and how does one code for the desired result?

Looking forward to your replies:).

If you use Tkinter there are over a million different colors to pick from.

# select a color from the color dialog and color the root window
# there are also a few named colors Tkinter can use directly:
# "white", "black", "red", "green", "blue", "cyan", "yellow", "magenta"
from Tkinter import *
import tkColorChooser
root = Tk()
colorTuple = tkColorChooser.askcolor()
# contains RBG tuple and hex-value as rrggbb
print colorTuple     # for red = ((255, 0, 0), '#ff0000')
print colorTuple[1]  # #ff0000
# Tkinter uses hex_value or element 1 of the tuple

For "Hello World" Tkinter example in color see:

G'day again,

Great work on the Tkinter colour problem this'll definitely help because it has both the colour numbers and the Hex values!:icon_cheesygrin:

Even better work on the "Hello, world!" example! I've got about 100 lines I have to colour in for different clues on a game I'm working on and this is THE way to go. Good one:icon_cheesygrin: :icon_cheesygrin: :icon_cheesygrin:.

How much money do I owe you? (only kidding).


This question has already been answered. Start a new discussion instead.