python 动态绘制爱心的示例

代码

import turtle

turtle.bgcolor("black")

turtle.pensize(2)

sizeh = 1.2

def curve():

for ii in range(200):

turtle.right(1)

turtle.forward(1 * sizeh)

turtle.speed(0)

turtle.color("red", "red")

turtle.begin_fill()

turtle.left(140)

turtle.forward(111.65 * sizeh)

curve()

turtle.left(120)

curve()

turtle.forward(111.65 * sizeh)

turtle.end_fill()

turtle.hideturtle()

效果图

以上是 python 动态绘制爱心的示例 的全部内容, 来源链接: utcz.com/z/349276.html

回到顶部