1.turtle

作者: 酷睿i1999 | 来源:发表于2020-09-16 10:27 被阅读0次

    海龟库turtle

    turtle.showturtle()
    
    turtle.write("xxx")
    
    turtle.forward(100)
    
    turtle.color("red")
    
    turtle.left(90)
    
    turtle.circle(50)
    
    turtle.goto(0,0)
    
    turtle.penup()
    
    turtle.pendown()
    
    turtle.width(10)
    
    turtle.done() 放在程序的最后,使窗口持续打开。
    

    example:

    奥运五环

    
    import turtle
    
    turtle.width(10)
    
    turtle.color("blue")
    
    turtle.circle(50)
    
    turtle.color("black")
    
    turtle.penup()
    
    turtle.goto(120,0)
    
    turtle.pendown()
    
    turtle.circle(50)
    
    turtle.color("red")
    
    turtle.penup()
    
    turtle.goto(240,0)
    
    turtle.pendown()
    
    turtle.circle(50)
    
    turtle.color("yellow")
    
    turtle.penup()
    
    turtle.goto(60,-50)
    
    turtle.pendown()
    
    turtle.circle(50)
    
    turtle.color("green")
    
    turtle.penup()
    
    turtle.goto(180,-50)
    
    turtle.pendown()
    
    turtle.circle(50)
    
    
    image

    相关文章

      网友评论

          本文标题:1.turtle

          本文链接:https://www.haomeiwen.com/subject/toyzektx.html