赞
踩
1.使用turtle库绘制一个红色五角星图形
import turtle
turtle.pensize(4)
turtle.pencolor("black")turtle.fillcolor("red")
turtle.begin_fill()
for _ in range(5):
turtle.forward(200)
turtle.right(144)turtle.end_fill()
2.使用turtle库绘制一个六角形
import turtle
turtle.setup(650,350,200,200)
turtle.penup()
turtle.pensize(1)
turtle.pencolor("red")
turtle.fillcolor("yellow")turtle.fd(100)
turtle.seth(30)
turtle.pendown()
turtle.begin_fill()
turtle.fd(80)
turtle.seth(-90)
turtle.fd(80)
turtle.seth(150)
turtle.fd(80)
turtle.end_fill()
turtle.penup()
turtle.seth(30)
turtle.fd(80/3)
turtle.seth(90)
turtle.fd(80/3)
turtle.pendown()
turtle.begin_fill()
turtle.seth(-30)
turtle.fd(80)
turtle.seth(-150)
turtle.fd(80)
turtle.seth(90)
turtle.fd(80)
turtle.end_fill()
3.使用turtle库绘制一个叠加等边三角形
import turtle
turtle.setup(650,350,200,200)
turtle.penup()
turtle.pensize(1)
turtle.pencolor("red")
turtle.fillcolor("purple")
turtle.begin_fill()
turtle.seth(60)
turtle.pendown()
turtle.fd(50)
turtle.seth(-60)
turtle.fd(100)
turtle.seth(-180)
turtle.fd(100)
turtle.seth(60)
turtle.fd(50)
turtle.seth(0)
turtle.fd(50)
turtle.seth(-120)
turtle.fd(50)
turtle.seth(120)
turtle.fd(50)
turtle.end_fill()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。