首页 > 其他 > 详细

turtle画五星红旗

时间:2018-03-20 17:15:11      阅读:250      评论:0      收藏:0      [点我收藏+]
import turtle

def goto(x,y):
    turtle.up();
    turtle.goto(x,y);
    turtle.down;

def drawxwjx(x):
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(x)
        turtle.right(144)
    turtle.end_fill()

turtle.setup(600,400,0,0)
turtle.color("yellow")
turtle.bgcolor("red")

goto(-260,120)
turtle.begin_fill()
for i in range(5):
    turtle.forward(100)
    turtle.right(144)
turtle.end_fill()

for i in range(4):
    x = 1
    if i in [0,3]:
        x = 0
    goto(-120+x*45,180-i*45)
    turtle.left(15-i*15)
    drawxwjx(30)

turtle.hideturtle()

turtle.done()
技术分享图片

 


  

turtle画五星红旗

原文:https://www.cnblogs.com/wlh0329/p/8609978.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!