# ChapterAnimation/colorSleep.py """ uses of sleep """ import random import time #for time.sleep(SECS) from graphics import * def randColor(): r = random.randrange(256) #red g = random.randrange(256) #green b = random.randrange(256) #blue return color_rgb(r,g,b) def main(): win = GraphWin( "Change color", 300,300) mycc = "red" while True: win.setBackground( mycc ) time.sleep(3) mycc = randColor() # Text(Point(150,150),mycc).draw(win) main()