#!usr\bin\python3
# -*- coding:utf-8 -*-
import turtle
x=100
turtle.pencolor("red")
turtle.fillcolor("red")
turtle.begin_fill()
def f():
turtle.forward(x)
turtle.right(144)
for i in range(5):
f()
turtle.end_fill
turtle.hideturtle()

本文介绍了使用Python的Turtle库创建一个红色填充的心形图案,通过调用`begin_fill`、`forward`、`right`和`end_fill`等函数实现基本图形绘制。适合初学者了解基础图形编程。
#!usr\bin\python3
# -*- coding:utf-8 -*-
import turtle
x=100
turtle.pencolor("red")
turtle.fillcolor("red")
turtle.begin_fill()
def f():
turtle.forward(x)
turtle.right(144)
for i in range(5):
f()
turtle.end_fill
turtle.hideturtle()


被折叠的 条评论
为什么被折叠?