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做图

猜你喜欢

转载自blog.csdn.net/zycdn/article/details/92399688