#coding=UTF8 from turtle import * import turtle, time , random color("purple") pensize(1) speed(1) up() aa = 470*2 bb = 390*2 goto(-470,-390) down() # 第1圈------------------ forward(aa-2*0) left(90) #下面那条 forward(bb-2*0) left(90) # 右边往上 forward(aa-2*0) left(90) # 上面那条 forward(bb-2*1) left(90) # 左边往下 # 第2-100圈------------------ #i = 1 i = 2 j = 1 colormode(255) r = random.randint(0, 255) g = random.randint(0, 255) b = random.randint(0, 255) for i in range(2,600,2): r = r+10 g = 1+10 b = 1+10 if r>255: r=random.randint(0, 255) if g>255: g=random.randint(0, 255) if b>255: b=random.randint(0, 255) color(r, g, b) forward(aa-2*(j)) left(90) #下面那条 forward(bb-2*(i)) left(90) # 右边往上 forward(aa-2*(i)) left(90) # 上面那条 forward(bb-2*(j+2)) left(90) # 左边往下i j = j + 2 up() goto(0,0) down() color("red") write("Done") time.sleep(10)