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

  • 相关阅读:
    关键字static
    关键字const有什么含义?
    关于目标
    B/B+树的初步理解(一)
    优先队列(priority_queue)
    哨兵的作用
    数学笑话集(一)

    排序算法小结(一)
    KMP算法
  • 原文地址:https://www.cnblogs.com/zhangjinyi97/p/11722225.html
Copyright © 2011-2022 走看看