Blue Sky flag:
ImportTurtle as TImportMatht.colormode (255) Rcblue= (4,0,174)defol (r,n): NA= 15/180 *Math.PI ol=2*r*math.cos (NA) ol=Int (round (OL))returnoldefLoop (r,n): T.FD (OL (R,n)) T.right (150)defMain1 (A, B): T.color ('Gray', Rcblue) T.penup () T.right (90) T.FD (b/2) T.left (90) T.pendown () T.begin_fill () t.fd (a/2) T.left (90) T.FD (b) T.left (90) T.FD (a) t.left (90) T.FD (b) T.left (90) T.FD (a/2) T.end_fill () T.penup () T.goto (0,0) t.seth (0) T.pendown ()defmain2 (r,n): T.pensize= 20T.color (' White',' White') T.penup () t.fd (R) t.right (180-30/2) T.pendown () T.begin_fill () forIinchRange (12): Loop (r,n) T.end_fill () T.penup () T.goto (0,0) t.seth (0) T.pendown ()defmain3 (R1,R2): T.color (Rcblue, Rcblue)#T.color (), not T.pencolor ()T.begin_fill () t.up () T.right (90) T.FD (R1) T.left (90) T.PD () t.circle (R1) t.goto (0, 0) t.end_fill () T.color (' White',' White') T.begin_fill () T.pu () T.right (90) T.FD (R2) T.left (90) T.PD () t.circle (R2) T.end_fill () T.penup () t.goto (0, 0) t.seth (0) T.pendown ()defMain (): R=a/4N=8R2=a/8R1=b*17/80Main1 (A, B) main2 (r,n) main3 (R1,R2) a=1020b=680T.setup (1000,700,100, 0) main () T.done ( )
Flag Chart:
Blue Sky The core of the Montreal Red flag or draw blue sky flag, need to pay attention to coordinates:
ImportTurtle as TImportMatht.colormode (255) Rcblue= (4,0,174) rcred= (254, 0,0)defol (r,n): NA= 15/180 *Math.PI ol=2*r*math.cos (NA) ol=Int (round (OL))returnoldefLoop (r,n): T.FD (OL (R,n)) T.right (150)defMain0 (A, B):#fast with Goto when there are no loops and complex angle operationsT.color (rcred) T.penup () T.goto (-a/2,b/2) T.pendown () T.begin_fill () T.goto (-a/2,-b/2) T.goto (a/2,-b/2) T.goto (a/2,b/2) T.end_fill () T.penup () T.goto (-a/4,b/4) T.pendown ()defmain1 (A1,B1): T.color ('Gray', Rcblue) T.penup () T.right (90) T.FD (B1/2) T.left (90) T.pendown () T.begin_fill () t.fd (A1/2) T.left (90) T.FD (B1) T.left (90) T.FD (A1) T.left (90) T.FD (B1) T.left (90) T.FD (A1/2) T.end_fill () T.penup () T.goto (-a/4,b/4) t.seth (0) T.pendown ()defmain2 (r,n): T.pensize= 20T.color (' White',' White') T.penup () t.fd (R) t.right (180-30/2) T.pendown () T.begin_fill () forIinchRange (12): Loop (r,n) T.end_fill () T.penup () T.goto (-a/4,b/4) t.seth (0) T.pendown ()defmain3 (R1,R2): T.color (Rcblue, Rcblue)#T.color (), not T.pencolor ()T.begin_fill () t.up () T.right (90) T.FD (R1) T.left (90) T.PD () t.circle (R1) T.end_fill () t.penup () T.goto (-a/4,b/4) T.pendown () T.color (' White',' White') T.begin_fill () T.pu () T.right (90) T.FD (R2) T.left (90) T.PD () t.circle (R2) T.end_fill () t.penup () T.goto (-a/4,b/4) t.seth (0) T.pendown ()defMain (b): A1= A/2B1= B/2R= A1/4N= 8R2= A1/8R1= B1 * 17/80Main0 (A, B) main1 (A1,B1) main2 (r,n) main3 (R1,R2) a=1020b=680T.setup (1100,700,100, 0) main (A, b) t.done ()
Flag Chart:
Use Python to draw the blue sky flag and the blue sky everywhere Red flag