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

    import turtle
    # circle有三个参数,1.半径每像数,2.steps=X 分部,3.extent=X 度数
    #画一个半径为十的圆
    #turtle.circle(10)
    #画一个正八边形
    #turtle.circle(30,steps=8)
    #画一个120的弧
    #turtle.circle(50,extent=120)

    #1.同切圆
    #for i in range(10):
    # turtle.circle(100-(i*10))

    #2.同心圆
    #for i in range(10):
    # turtle.up()
    # turtle.goto(0,i*10)
    # turtle.down()
    # turtle.circle(100-(i*10))

    #3.五角星
    #for i in range(5):
    # turtle.forward(100)
    # turtle.right(144)

    #4.填充黄色的五角星
    #turtle.color('yellow')
    #turtle.fillcolor('yellow')
    #turtle.begin_fill()
    #for i in range(5):
    # turtle.forward(100)
    # turtle.right(144)
    #turtle.end_fill()

    #在红底下的五颗五角星
    turtle.color('yellow')
    turtle.fillcolor('yellow')
    turtle.bgcolor('red')
    turtle.up()
    turtle.goto(-300,300)
    turtle.down()

    for j in range(6):
      turtle.begin_fill()
      for i in range(5):
        turtle.forward(100)
        turtle.right(144)
       turtle.end_fill()
      turtle.up()
      turtle.goto(-300+(j*100),300-(j*80))
      turtle.down()

  • 相关阅读:
    ExecuteScalar 返回值问题
    c#中怎么用for循环遍历DataTable中的数据
    select多用户之间通信
    python快速学习6
    python快速学习5
    python快速学习4
    python快速学习3
    python快速学习2
    arm处理器
    软链接与硬链接
  • 原文地址:https://www.cnblogs.com/alliancehacker/p/7493017.html
Copyright © 2011-2022 走看看