用户:喵来运转~喵查看:10 回复:3 评论:10 创建时间:2021-08-21T10:57:07
【作品展示】

【作品介绍】
感谢编程猫的支持,成功进阶Python
【作品源代码】
import turtle
pen = turtle.Pen()
pen.pensize(3)
pen.speed(0)
pen.hideturtle()
turtle.colormode(255)
def draw_hexagon(fillcolor, y, side_length):
pen.penup()
pen.goto(0, y)
pen.pendown()
pen.fillcolor((fillcolor))
pen.begin_fill()
pen.setheading(30)
for i in range(6):
pen.forward(side_length)
pen.left(360/6)
pen.end_fill()
def draw_pentagram(fillcolor, y, side_length):
pen.penup()
pen.goto(0, y)
pen.pendown()
pen.fillcolor((fillcolor))
pen.begin_fill()
pen.setheading(-72)
for i in range(5):
pen.forward(side_length)
pen.left(72)
pen.forward(side_length)
pen.right(144)
pen.end_fill()
pen.dot(400, (0, 200, 255))
pen.dot(380, (255, 255, 200))
pen.dot(320, (222, 100, 82))
pen.dot(300, (0, 0, 0))
draw_hexagon((255, 215, 0), -140, 140)
draw_hexagon((0, 0, 0), -130, 130)
draw_pentagram((255, 205, 62), 120, 80)
draw_pentagram((255, 215, 0), 90, 60)
turtle.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn