Python turtle库画图

第一次尝试用turtle画图,很艰难、不完美但十分具有纪念意义!
在这里插入图片描述
希望可以和各位多多交流,共同进步!在这里插入图片描述

#五星红旗

import turtle


turtle.speed(10)
turtle.hideturtle()  #隐藏图标

turtle.pencolor("red")

#外框
turtle.penup()
turtle.goto(-300, 200)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("red")
turtle.fd(600)
turtle.right(90)
turtle.fd(400)
turtle.right(90)
turtle.fd(600)
turtle.right(90)
turtle.fd(400)
turtle.right(90)
turtle.end_fill()

turtle.pencolor("yellow")

#大星星
turtle.penup()
turtle.goto(-275, 115)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.forward(90)
turtle.right(144)
turtle.forward(90)
turtle.right(144)
turtle.forward(90)
turtle.right(144)
turtle.forward(90)
turtle.right(144)
turtle.forward(90)
turtle.end_fill()

#小星星1
turtle.seth(0)
turtle.left(25)
turtle.penup()
turtle.goto(-187, 169)
turtle.pendown()


turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.end_fill()

#小星星2
turtle.penup()
turtle.goto(-275, 115)
turtle.pendown()
turtle.seth(0)
turtle.left(21)
turtle.penup()
turtle.goto(-147, 133)
turtle.pendown()

turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.end_fill()

#小星星3
turtle.penup()
turtle.goto(-275, 115)
turtle.pendown()
turtle.seth(0)
turtle.right(21)
turtle.penup()
turtle.goto(-147, 93)
turtle.pendown()


turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.end_fill()

#小星星4
turtle.penup()
turtle.goto(-275, 115)
turtle.pendown()
turtle.seth(0)
turtle.right(25)
turtle.penup()
turtle.goto(-187, 41)
turtle.pendown()


turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.right(144)
turtle.forward(30)
turtle.end_fill()
  • 19
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值