zoukankan      html  css  js  c++  java
  • turtle库基础练习

    1. 画一组同切圆
    2. 画一组同心圆
    3. 画一个五角星
    4. 画一个黄色实心五角星 

    #同心圆
    import turtle
    turtle.shape('turtle')
    turtle.circle(10)
    turtle.up()
    turtle.goto(0,-10)
    turtle.down()
    turtle.circle(20)
    turtle.up()
    turtle.goto(0,-20)
    turtle.down()
    turtle.circle(30)
    turtle.up()
    turtle.goto(0,-30)
    turtle.down()
    turtle.circle(40)
    #同切圆
    turtle.circle(10)
    turtle.circle(20)
    turtle.circle(30)
    turtle.circle(40)
    #五角星
    import turtle
    turtle.forward(50)
    turtle.right(144)
    turtle.forward(50)
    turtle.right(36)
    turtle.right(19)
    turtle.forward(50)
    turtle.reset()
    turtle.forward(50)
    turtle.right(144)
    turtle.forward(50)
    turtle.right(144)
    turtle.forward(50)
    turtle.right(144)
    turtle.forward(50)
    turtle.right(144)
    turtle.forward(50)

    #for循环五角星

    import turtle
    for i in range(5):
        turtle.forward(50)
        turtle.right(144)

    #黄色实心五角星

    import turtle
    turtle.bgcolor('red')
    turtle.color('yellow')
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(50)
        turtle.right(144)
    turtle.end_fill()

    #国旗

    import turtle
    turtle.bgcolor('red')
    turtle.color('yellow')


    turtle.begin_fill()
    turtle.up()
    turtle.goto(-220,180)
    for i in range(5):

        turtle.forward(50)
        turtle.right(144)
    turtle.end_fill()

    turtle.begin_fill()
    turtle.up()
    turtle.goto(-140,180)
    turtle.left(30)
    for i in range(5):
        turtle.forward(30)
        turtle.right(144)

    turtle.end_fill()

    turtle.begin_fill()
    turtle.up()
    turtle.goto(-145,140)
    for i in range(5):
        turtle.forward(30)
        turtle.right(144)
    turtle.end_fill()

    turtle.begin_fill()
    turtle.up()
    turtle.goto(-170,110)
    for i in range(5):
        turtle.forward(30)
        turtle.right(144)
    turtle.end_fill()

    turtle.begin_fill()
    turtle.up()
    turtle.goto(-150,220)
    for i in range(5):
        turtle.forward(30)
        turtle.right(144)
    turtle.end_fill()

  • 相关阅读:
    zoj 2165
    zoj 1005 Jugs
    谈如何使用c中的qsort快速排序库函数 按主次关键字正确排序
    zoj 3197 Google Book
    zoj 3710 Friends
    IOS编程中比较两个日期的大小
    iOS中常用的四种数据持久化方法简介
    iphone开发基础:loadView/viewDidLoad/initWithNibName/awakeFromNib/initWithCoder的用法
    不通过AppStore发布iOS应用教程
    iOS之视频播放MPMoviePlayerViewController
  • 原文地址:https://www.cnblogs.com/decadeyu/p/7493116.html
Copyright © 2011-2022 走看看