当前位置:   article > 正文

python语言:五星红旗制作

python语言:五星红旗制作

五星红旗代码如下:

import turtle as tu

tu.hideturtle()     #隐藏海龟
tu.speed(10)
tu.title("Chinese National Flag.")   #显示海龟绘图窗口的标题栏文本

n = float(tu.textinput("N","Please enter the times you want."))       #国旗放大的倍数,textinput()函数用于返回用户输入的参数

#旗面
tu.penup()
tu.goto(-150*n,100*n)
tu.pendown()
tu.pencolor("red")
tu.begin_fill()
tu.fillcolor("red")
tu.fd(300*n)
tu.right(90)
tu.fd(200*n)
tu.right(90)
tu.fd(300*n)
tu.right(90)
tu.fd(200*n)
tu.end_fill()

#大星星
tu.penup()
tu.goto(-100*n,80*n)
tu.pendown()
tu.pencolor("yellow")
tu.begin_fill()
tu.fillcolor("yellow")
tu.setheading(-72)
for i in range(5):
    tu.fd(57.06*n)
    tu.right(144)
tu.end_fill()

#小星星1
tu.penup()
tu.goto(-60*n,70*n)
tu.pendown()
tu.pencolo

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/421583
推荐阅读
相关标签
  

闽ICP备14008679号