python給我們提供了豐富多彩的模塊,其中turtle是其中圖形繪製方面的一個非常重要模塊。通過turtle模塊我們可以繪製各種各樣的圖形:
import turtle as t
t.penup()
t.seth(-90)
t.fd(160)
t.pendown()
t.pensize(20)
t.colormode(255)
for j in range(10):
t.speed(1000)
t.pencolor(25*j,5*j,15*j)
t.seth(130)
t.fd(220)
for i in range(23):
t.circle(-80,10)
t.seth(100)
for i in range(23):
t.circle(-80,10)
t.fd(220)
t.hideturtle()
t.done()