python经典程序练习题12:绘制正方形螺旋线

xiaoxiao2021-03-01  13

绘制下图的正方形螺旋线:

源代码:

import turtle as t t.pen(speed=0) #加快绘图速度 t.penup() t.goto(-200, -200) #以左下角某处为起点 t.pendown() t.seth(0) length = 400 while (length !=0): #利用正方形螺旋线的性质来绘图 t.fd(length) t.left(90) length -= 2.5 t.hideturtle() #绘图结束后把海龟头(笔触头)隐藏起来 t.done() #绘图结束后使窗口停留

 

转载请注明原文地址: https://www.6miu.com/read-3350098.html

最新回复(0)