turtle库
2021-09-04 本文已影响0人
第六九书
画五角星(一)
from turtle import *
fillcolor("red")
begin_fill()
while True:
fd(200)
rt(144)
if abs (pos())<1:
break
end_fill()
![](https://img.haomeiwen.com/i14272177/403142b4004be04c.png)
画五角星(二)
from turtle import *
color("red","red")
begin_fill()
while True:
fd(200)
rt(144)
if abs (pos())<1:
break
end_fill()
![](https://img.haomeiwen.com/i14272177/abcff9de009efd3b.png)
画五角星(三)
import turtle
def main():
t = turtle.Turtle()
t.hideturtle()
lengthOfSize = 200
drawFivePointStar(t,0,0,lengthOfSize)
def drawFivePointStar(t,x,y,lengthOfSize):
t.up()
t.goto(x,y)
t.left(36)
t.down()
for i in range(5):
t.forward(lengthOfSize)
t.left(144)
main()
![](https://img.haomeiwen.com/i14272177/54a7f44cd66be8d5.png)