标签:turtle forward fill nbsp tle hid abs color begin
五角星
from turtle import *
fillcolor(‘red‘)
hideturtle()
begin_fill()
while True:
forward(200)
right(144)
if abs(pos())<1:
break
end_fill()
六角形
import turtle
turtle.left(30)
turtle.forward(144)
turtle.right(60)
turtle.forward(144)
turtle.right(60)
turtle.forward(144)
turtle.right(60)
turtle.forward(144)
turtle.right(60)
turtle.forward(144)
turtle.right(60)
turtle.forward(144)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
turtle.left(60)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
turtle.left(60)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
turtle.left(60)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
turtle.left(60)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
turtle.left(60)
turtle.forward(144)
turtle.right(120)
turtle.forward(144)
等边三角形
import turtle as t
t.setup(600, 600, None,None)
t.pu()
t.fd(-120)
t.pensize(5)
t.width(5)
t.pd()
t.fd(250)
t.seth(120)
t.fd(250)
t.seth(-120)
t.fd(250)
t.fd(250)
t.seth(0)
t.fd(250)
t.fd(250)
t.seth(120)
t.fd(250)
t.seth(-120)
t.fd(250)
t.seth(120)
t.fd(250)
标签:turtle forward fill nbsp tle hid abs color begin
原文地址:https://www.cnblogs.com/gzzfh/p/12499046.html