# # Draws a smooth color gradient from black at the top of the screen to gold # at the bottom of the screen. # from SimpleGraphics import * # Change the window size so that it is tall and narrow. resize(200, 900) # For each row in the window... for row in range(0, getHeight()): # Compute the amount of red, green and blue for the current row. red = row / (getHeight() - 1) * 255 green = row / (getHeight() - 1) * 192 blue = row / (getHeight() - 1) * 64 # Change the color so that it is correct for the current row. setColor(red, green, blue) # Draw the line across the window. line(0, row, getWidth() - 1, row)