码迷,mamicode.com
首页 > 其他好文 > 详细

课堂练习(画五星红旗)

时间:2017-09-11 19:54:02      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:imp   背景   fill   span   got   .com   color   range   logs   

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

 技术分享

 

课堂练习(画五星红旗)

标签:imp   背景   fill   span   got   .com   color   range   logs   

原文地址:http://www.cnblogs.com/gzw2017/p/7506271.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!