本文主要是介绍python画六角形的代码,怎么用python画六角星,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
这篇文章主要介绍了怎么用python画六角星,具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获,下面让小编带着大家一起了解一下。
import turtle as t
t.penup()
t.fd(-200)
t.write("一朵小花\n", align="right", font=("楷体", 16, "bold"))def draw_leaf():for i in range(2):for j in range(15):t.forward(5)t.right(6)t.right(90)t.goto(0,-150)
t.left(90)
t.down()
t.forward(50)
t.fillcolor("green")
t.begin_fill()
draw_leaf()
t.end_fill()
t.forward(50)
t.right(270)
t.fillcolor("green")
t.begin_fill()
draw_leaf()
t.end_fill()
t.right(90)
t.forward(130)
t.fillcolor("red")
t.begin_fill()
for i in range(6):draw_leaf()t.right(60)
t.end_fill()t.done()
这篇关于python画六角形的代码,怎么用python画六角星的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!