# William T. Verts - Lab #3 - Greebles / Anime Eyes from DrBillsInputOutput import * from DrBillsSVGwriter import * import math #-------------------------------------------------------------- # This function paints a bunch of lines radially around # where R1 and R2 are the inner and outer radii and Segments # indicates the number of lines. #-------------------------------------------------------------- def addStarburst (Xc,Yc,R1,R2,Segments): return #-------------------------------------------------------------- # This function paints ONE anime eyeball, 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, and highlights are derived from center point # and the radius of the iris R. #-------------------------------------------------------------- def addEyeball (Xc,Yc,R,NewColor): return #-------------------------------------------------------------- # This function paints a Greeble at center with Xradius # indicating the size of the Greeble (everything else is # computed from those three values). The Greeble has ellipses # for the body and mouth, and calls addEyeball TWICE (once for # each eye). #-------------------------------------------------------------- def addGreeble (Xc,Yc,Xradius,NewColor): return #-------------------------------------------------------------- # This function computes the optimal X radius for the Greeble # based on the size of the graphic, then plots the Greeble at # the center of the graphic with that X radius. #-------------------------------------------------------------- def Stare (NewColor,W,H): return #-------------------------------------------------------------- # Prompt the user for a color. You MAY NOT change ANY code # in the requestColor function! #-------------------------------------------------------------- def requestColor (Message): Colors = ["red","green","blue","cyan","magenta","yellow"] while True: S = requestString(Message) S = S.lower() if (S in Colors): return S #-------------------------------------------------------------- # This function establishes the size of the canvas and the # color of the eyes. You MAY NOT change ANY code in # the Main function except to replace my name with yours! #-------------------------------------------------------------- def Main(): Filename = pickAFolder("Enter Folder for SVG file")+"/Greeble.svg" Width = requestIntegerInRange("Enter Width",10,1000) Height = requestIntegerInRange("Enter Height",10,1000) Color = requestColor("Enter Iris Color") SVGheader(Filename, Width, Height) SVGrectangle(0,0,Width,Height,"black","white") SVGtext(10, 35, "William T. Verts", 36, "black", "Arial", True) Stare(Color,Width,Height) SVGfooter() return