最近确实太忙了,时间太零碎了 只能偶尔学下 今天简单学习了以下 乌龟库
import turtle
# 设置画布和画笔
canvas = turtle.Screen()
canvas.bgcolor("black")
pen = turtle.Turtle()
pen.color("red")
pen.shape("turtle")
pen.speed(2)
# 绘制爱心
pen.up()
pen.goto(0, -100)
pen.down()
pen.begin_fill()
pen.left(140)
pen.forward(224)
for i in range(200):
pen.right(1)
pen.forward(2)
pen.left(120)
for i in range(200):
pen.right(1)
pen.forward(2)
pen.forward(224)
pen.end_fill()
# 隐藏画笔
pen.hideturtle()
# 结束绘制
turtle.done()
效果如下: