turtle库基础练习

  1. 画一组同切圆
    import turtle
    turtle.shape("turtle")
    turtle.circle(50)
    turtle.circle(100)
    turtle.circle(150)

     

  2. 画一组同心圆
    import turtle
    turtle.shape("turtle")
    turtle.pos()
    turtle.circle(50)
    turtle.up()
    turtle.goto(0,-50)
    turtle.down()
    turtle.circle(100)
    
    turtle.up()
    turtle.goto(0,-100)
    turtle.down()
    turtle.circle(150)
    
    turtle.up()
    turtle.goto(0,-150)
    turtle.down()
    turtle.circle(200)

     

  3. 画一个五角星
    import turtle
    turtle.shape("turtle")
    
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)

     

  4. 画一个黄色实心五角星
    import turtle
    turtle.shape("turtle")
    turtle.color("yellow")
    turtle.bgcolor("red")
    turtle.fillcolor("yellow")
    turtle.begin_fill()
    
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)
    
    turtle.end_fill()
    turtle.hideturtle()

     

  5. 画左上角的五颗五角星
    import turtle
    turtle.shape("turtle")
    
    turtle.color("yellow")
    turtle.bgcolor("red")
    turtle.fillcolor("yellow")
    turtle.begin_fill()
    
    
    turtle.up()
    turtle.goto(-270,170)
    turtle.down()
    
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)
    turtle.right(144)
    turtle.forward(100)
    
    turtle.end_fill()
    turtle.hideturtle()
    
    
    
    
    
    
    turtle.color("yellow")
    turtle.bgcolor("red")
    turtle.fillcolor("yellow")
    turtle.begin_fill()
    turtle.up()
    turtle.goto(-130,170)
    turtle.down()
    
    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()
    turtle.hideturtle()
    
    
    
    
    turtle.color("yellow")
    turtle.bgcolor("red")
    turtle.fillcolor("yellow")
    turtle.begin_fill()
    turtle.up()
    turtle.goto(-120,160)
    turtle.down()
    
    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()
    turtle.hideturtle()
    
    
    
    turtle.color("yellow")
    turtle.bgcolor("red")
    turtle.fillcolor("yellow")
    turtle.begin_fill()
    turtle.up()
    turtle.goto(-160,100)
    turtle.down()
    
    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()
    turtle.hideturtle()
    
    
    turtle.color("yellow")
    turtle.bgcolor("red")
    turtle.fillcolor("yellow")
    turtle.begin_fill()
    turtle.up()
    turtle.goto(-155,200)
    turtle.down()
    
    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()
    turtle.hideturtle()

posted @ 2017-09-12 13:28  091王卡  阅读(189)  评论(0)    收藏  举报