# TurkeySol.py # CS 1110 # February 2016 """ Contains a function for drawing the Turkish flag and an Application Script that can be used to check it out it out """ from SimpleGraphics import * def DrawTurkey(x,y,W): """ Draws the Turkish Flag. W is the vertical dimension The center of the large red rectangle is at (x,y). Precondition: x,y, and W are numbers and W>0. """ W = float(W) # Important measurements L = 1.5*W A = W/2 B = W/2 C = W/16 D = 2*W/5 E = W/3 F = W/4 M = L/30; # It is not quite red... R = [.89,.039,.09] DrawRect(x,y,L,W,FillColor=R,EdgeWidth=0) # Draw the white rectangle on the edge DrawRect(x-L/2-M/2,y,M,W,FillColor=WHITE,EdgeWidth=0) # Draw the white disk DrawDisk(x-L/2+A,y,B/2,FillColor=WHITE,EdgeWidth=0) # Take a "bite"out of the white disk by drawing a well placed red disk DrawDisk(x-L/2+A+C,y,D/2,FillColor=R,EdgeWidth=0) # Draw the tilted star DrawStar(x-L/2+A+C-D/2+E+F/2,y,F/2,FillColor=WHITE,theta=18,EdgeWidth=0) # Application Script if __name__ == '__main__': # Display the Turkish flag on a black background. MakeWindow(10,bgcolor=BLACK,labels=False) DrawTurkey(0,0,8) ShowWindow()