zoukankan      html  css  js  c++  java
  • 画图初体验

    Python初尝试画笑脸

    • 源代码

    import turtle

    #画脸
    t = turtle.Pen()
    t.speed(100)
    #t.color('orange')
    t.fillcolor('yellow')
    t.up()
    t.begin_fill()
    t.goto(0, -150)
    t.circle(150)
    t.down()
    t.end_fill()

    #画嘴
    t.pensize(10)

    t.up()
    t.goto(-70, -70)
    t.down()
    t.seth(-90)
    t.circle(70, 180)

    #画左眉毛
    t.pensize(4)
    t.up()
    t.goto(-40, 75)
    t.down()
    t.seth(90)
    t.circle(30, 180)
    #画右眉毛
    t.pensize(4)
    t.up()
    t.goto(80, 75)
    t.down()
    t.seth(90)
    t.circle(30, 180)
    #画左眼
    t.pensize(20)
    t.up()
    t.goto(-80, 70)
    t.down()
    t.circle(4)
    #画右眼
    t.pensize(20)
    t.up()
    t.goto(47, 70)
    t.down()
    t.circle(4)
    #拓展鼻子
    t.pensize(4)
    t.up()
    t.goto(20, -20)
    t.down()
    t.seth(-180)
    t.forward(60)
    t.seth(45)
    t.forward(60)
    # t.hideturtle()
    turtle.mainloop()
    #纪念第一次画笑脸

    Python画五角星

    • 源代码

      import turtle

      t = turtle.Pen()
      t.shape('turtle')

      t.fillcolor('red')
      t.begin_fill()
      for i in range(5):
        t.forward(100)
        t.left(-144)
      t.end_fill()
      t.hideturtle()
      turtle.mainloop()

      python画三角形

    • 源代码

    import turtle

    t = turtle.Pen()
    t.shape('turtle')
    t.color('red')
    t.fillcolor('blue')
    t.begin_fill()
    for i in range(3):
      t.forward(100)
      t.left(120)
    t.end_fill()
    t.hideturtle()
    turtle.mainloop()

    python画蟒蛇

    • 源代码

      import turtle

      t = turtle.Pen()
      t.shape('turtle')
      t.up()
      t.fd(-250)
      t.down()
      t.pensize(25)
      t.seth(-40)
      t.color('purple')
      for i in range(4):
        t.circle(40, 80)
        t.circle(-40, 80)
      t.left(40)
      t.fd(40)
      t.circle(20, 180)
      t.fd(30)
      turtle.mainloop()
    •  

  • 相关阅读:
    SQL SERVER 分布式事务(DTC)
    .NET 笔试题--自已作答
    设计模式-观察者模式
    设计模式-迭代器模式
    设计模式-责任链模式
    C#中引用类型和值类型
    另一个 OleDbParameterCollection 中已包含 OleDbParameter 错误分析及解决办法
    R语言笔记-set.seed()函数
    R中的sample函数
    R语言包相关命令
  • 原文地址:https://www.cnblogs.com/zhangjinyi97/p/11722225.html
Copyright © 2011-2022 走看看