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

    画一组同切圆

    # 同切圆
    
    import turtle
    
    turtle.circle(10)
    turtle.circle(20)
    turtle.circle(30)
    turtle.circle(40)
    turtle.circle(50)
    turtle.circle(60)
    turtle.circle(70)
    turtle.circle(80)
    

      

    画一组同心圆

    # 同心圆
    
    import turtle
    
    
    turtle.shape('turtle')
    turtle.color('green')
    turtle.fillcolor('green')
    
    
    turtle.circle(100)
    turtle.pos()
    turtle.up()
    turtle.goto(0,10)
    turtle.down()
    
    turtle.circle(90)
    turtle.pos()
    turtle.up()
    turtle.goto(0,20)
    turtle.down()
    
    turtle.circle(80)
    turtle.pos()
    turtle.up()
    turtle.goto(0,30)
    turtle.down()
    
    turtle.circle(70)
    turtle.pos()
    turtle.up()
    turtle.goto(0,40)
    turtle.down()
    
    turtle.circle(60)
    turtle.pos()
    turtle.up()
    turtle.goto(0,50)
    turtle.down()
    
    turtle.circle(50)
    turtle.pos()
    turtle.up()
    turtle.goto(0,60)
    turtle.down()
    
    turtle.circle(40)
    turtle.pos()
    turtle.up()
    turtle.goto(0,70)
    turtle.down()
    
    turtle.circle(30)
    turtle.pos()
    turtle.up()
    turtle.goto(0,80)
    turtle.down()
    
    turtle.circle(20)
    turtle.pos()
    turtle.up()
    turtle.goto(0,90)
    turtle.down()
    
    turtle.circle(10)
    turtle.pos()
    turtle.up()
    turtle.goto(0,100)
    turtle.down()
    
    turtle.circle(1)
    turtle.right(90)
    turtle.hideturtle()
    

      

    画一个五角星

    # 黄色五角星
    
    import turtle
    turtle.shape('turtle')
    
    
    
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    
    
    turtle.hideturtle()
    

      

    画一个黄色实心五角星

    # 黄色五角星
    
    import turtle
    turtle.shape('turtle')
    turtle.color('yellow')
    turtle.bgcolor('green')
    turtle.fillcolor('yellow')
    
    turtle.begin_fill()
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    turtle.end_fill()
    
    turtle.hideturtle()
    

      

    画左上角的五颗五角星

    # 画左上角的五颗五角星
    
    import turtle
    turtle.shape('turtle')
    turtle.color('yellow')
    turtle.bgcolor('red')
    turtle.fillcolor('yellow')
    
    
    turtle.pos()
    turtle.up()
    turtle.goto(-300,200)
    turtle.down()
    turtle.begin_fill()
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    turtle.forward(200)
    turtle.right(144)
    turtle.end_fill()
    
    turtle.pos()
    turtle.up()
    turtle.goto(-80,350)
    turtle.down()
    turtle.begin_fill()
    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)
    turtle.right(144)
    turtle.end_fill()
    
    turtle.pos()
    turtle.up()
    turtle.goto(-5,250)
    turtle.down()
    turtle.begin_fill()
    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)
    turtle.right(144)
    turtle.end_fill()
    
    turtle.pos()
    turtle.up()
    turtle.goto(-5,150)
    turtle.down()
    turtle.begin_fill()
    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)
    turtle.right(144)
    turtle.end_fill()
    
    turtle.pos()
    turtle.up()
    turtle.goto(-80,50)
    turtle.down()
    turtle.begin_fill()
    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)
    turtle.right(144)
    turtle.end_fill()
    
    turtle.hideturtle()
    

      

  • 相关阅读:
    [ASP.NET] Session 一些比较详细的知识(转自:http://blog.csdn.net/zhoufoxcn/archive/2006/11/08/1373685.aspx)
    ASP.NET2.0服务器控件之Render方法 (作者: 金属边缘 出处: 天极开发 )
    [Tip: word pdf] Word Save As PDF
    [Tip: Visual Studio]创建键盘快捷方式速查表
    [Tip: iShare Site] Move file/folder on iShare Site
    google的C++单元测试框架gtest
    XP and Win7 双系统安装教程
    Tip:How to Compact a PST File to Reduce Its Size in Outlook
    [Tip: Perforce]ModTime
    [Tool: fast copy cmd]ROBOCOPY
  • 原文地址:https://www.cnblogs.com/lhw1997/p/7509294.html
Copyright © 2011-2022 走看看