# William T. Verts - Lab #2 - Anime Eyes #-------------------------------------------------------------- # This function paints a filled circle of radius R # and color NewColor on the Canvas, using as # the coordinates of the center of the circle. # Xc, Yc, and R are all allowed to be floats. #-------------------------------------------------------------- def addCircleFilled (Canvas,Xc,Yc,R,NewColor=black): return #-------------------------------------------------------------- # This function paints a bunch of black lines radially around # where R1 and R2 are the inner and outer radii and # Segments indicates the number of lines. Xc, Yc, R1, and R2 # are all allowed to be floats. #-------------------------------------------------------------- def addStarburst (Canvas,Xc,Yc,R1,R2,Segments): return #-------------------------------------------------------------- # This function paints ONE anime eyeball on the Canvas, # centered at . The color of the iris is NewColor, the # pupil is black, and the highlights are white. The sizes and # positions of the iris, pupil, starburst, and highlights are # derived from center point and the radius R of the # iris. #-------------------------------------------------------------- def Eyeball (Canvas,Xc,Yc,R,NewColor): return #-------------------------------------------------------------- # This function CALLS Eyeball TWICE (once for each eye) to # place the pair of eyeballs on the screen. Stare must first # determine the correct radius and center positions for each # eye before calling Eyeball at all. #-------------------------------------------------------------- def Stare (Canvas,NewColor): return #-------------------------------------------------------------- # Prompt the user for a color. You MAY NOT change ANY code # in the requestColor function! #-------------------------------------------------------------- def requestColor(Message): while True: S = requestString(Message) S = S.lower() if (S == "red"): return red if (S == "green"): return green if (S == "blue"): return blue if (S == "cyan"): return cyan if (S == "magenta"): return magenta if (S == "yellow"): return yellow #-------------------------------------------------------------- # This function establishes the size of the canvas and the # color of the anime eyes. You MAY NOT change ANY code in # the Main function! #-------------------------------------------------------------- def Main(): W = requestIntegerInRange("Enter Width", 100, 1000) H = requestIntegerInRange("Enter Height", 100, 1000) C = requestColor("Enter Iris Color") Canvas = makeEmptyPicture(W,H,makeColor(240)) Stare(Canvas,C) show(Canvas) return