巧妙运用python画五星红旗

import turtle as t#代入turle把它转换为t更加方便使用
t.speed(0)
t.fillcolor('yellow')#fillcolor使用颜色 
t.penup()
t.goto(-300,200)
t.pendown()
t.begin_fill()#开始填充

for a in range(5):
    t.forward(80)#直线
    t.left(72)#左转
    t.forward(80)
    t.right(144)#右转
t.end_fill()#结束填充
t.fillcolor('yellow')
t.penup()
t.goto(-50, 260)
t.pendown()
t.begin_fill()
t.right(30)


for a in range(5):#利用for循环使图像画五笔,可以方便并简介代码
        t.forward(20)
        t.left(72)
        t.forward(20)
        t.right(144)
t.end_fill()
t.fillcolor('yellow')
t.penup()
t.goto(0, 200)
t.pendown()
t.begin_fill()



for a in range(5):
        t.forward(20)
        t.left(72)
        t.forward(20)
        t.right(144)

t.end_fill()

t.fillcolor('yellow')
t.penup()
t.goto(0, 100)
t.pendown()
t.begin_fill()
t.left(30)


for a in range(5):
        t.forward(20)
        t.left(72)
        t.forward(20)
        t.right(144)
t.end_fill()

t.fillcolor('yellow')
t.penup()
t.goto(-55, 50)
t.pendown()
t.begin_fill()
t.right(30)


for a in range(5):
        t.forward(20)
        t.left(72)
        t.forward(20)
        t.right(144)
t.end_fill()
t.bgcolor("red")
t.exitonclick()#此代码可以使程序运行完,不会直接退出。

希望大家能巧妙的运用turtle的函数,制作出更多有趣的图像

  • 17
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值