课堂练习(画五星红旗)

import turtle
turtle.speed(41)
turtle.penup()
turtle.goto(-300,240)
turtle.pendown()
##画国旗背景
turtle.fillcolor('red')
turtle.begin_fill()
turtle.forward(600)
turtle.right(90)
turtle.forward(400)
turtle.right(90)
turtle.forward(600)
turtle.right(90)
turtle.forward(400)
turtle.end_fill()
##画大五角星
turtle.penup()
turtle.goto(-263,163)
turtle.pendown()

turtle.color('yellow')
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.right(90)
for i in range(5):
    turtle.forward(100)
    turtle.right(144)
turtle.end_fill()


##画小五角星
##第一个
turtle.penup()
turtle.goto(-126,211)
turtle.pendown()

turtle.color('yellow')
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.right(90)
for i in range(5):
    turtle.forward(20)
    turtle.right(144)
turtle.end_fill()
##第二个
turtle.penup()
turtle.goto(-90,140)
turtle.pendown()

turtle.color('yellow')
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.right(90)
for i in range(5):
    turtle.forward(20)
    turtle.right(144)
turtle.end_fill()
##第三个
turtle.penup()
turtle.goto(-126,64)
turtle.pendown()

turtle.color('yellow')
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.right(90)
for i in range(5):
    turtle.forward(20)
    turtle.right(144)
turtle.end_fill()
##第四个
turtle.penup()
turtle.goto(-192,30)
turtle.pendown()

turtle.color('yellow')
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.right(90)
for i in range(5):
    turtle.forward(20)
    turtle.right(144)
turtle.end_fill()

 

 

posted @ 2017-09-11 18:09  14郭子维  阅读(172)  评论(0编辑  收藏  举报