# William T. Verts - Lab #4 - Anime Eyes from Graphics import * from Font8x8 import * import math #-------------------------------------------------------------- # 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 iris radius R. #-------------------------------------------------------------- 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 #-------------------------------------------------------------- # Plot a string S on the canvas where the lower left coordinate # is at (X pixels from the left, Y pixels from the top). #-------------------------------------------------------------- def PlotText (Canvas,X,Y,S,NewColor=black): return #-------------------------------------------------------------- # Prompt the user for a color. You MAY NOT change ANY code # in the requestColor function! #-------------------------------------------------------------- def requestColor(Message): while True: S = input(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 except for your name instead of mine! #-------------------------------------------------------------- def Main(): W = int(input("Enter Width --- ")) H = int(input("Enter Height --- ")) C = requestColor("Enter Iris Color --- ") Canvas = makeEmptyPicture(W,H,[192,192,192]) Stare(Canvas,C) PlotText (Canvas,10,10,"William T. Verts") WriteBMP("Eyeballs.bmp", Canvas) return