Python心形圖-採用turtle模塊畫心形

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()

 

turtle做圖

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章