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()
    •  

  • 相关阅读:
    Java之static理解
    linux安装vsftpd
    JS获取当前时间戳的三个方法
    git常用操作
    npm更新包
    springboot的mvn与gradle启动方式
    mac nginx compile
    [文摘]那些一心想要离开 BAT 的人,后来怎么样了?
    excel 常用法
    chrome 快捷键
  • 原文地址:https://www.cnblogs.com/zhangjinyi97/p/11722225.html
Copyright © 2011-2022 走看看