五角星 六角形 叠加等边三角形绘制

Posted gzzfh

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了五角星 六角形 叠加等边三角形绘制相关的知识,希望对你有一定的参考价值。

五角星

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)

 

 

以上是关于五角星 六角形 叠加等边三角形绘制的主要内容,如果未能解决你的问题,请参考以下文章