课堂练习(画五星红旗)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了课堂练习(画五星红旗)相关的知识,希望对你有一定的参考价值。

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()

 技术分享

 

以上是关于课堂练习(画五星红旗)的主要内容,如果未能解决你的问题,请参考以下文章

Python基础综合练习

课堂练习(条件循环函数定义字符串操作)

用PY画五星红旗

画一个五星红旗

turtle画五星红旗

Python基础-画五星红旗