zoukankan      html  css  js  c++  java
  • 用python绘画一些简单图片

    python画笑脸

    • 程序源代码
    import turtle
    
    #画脸
    t = turtle.Pen()
    t.speed(15)
    #t.circle(150)
    #t.color('orange')
    t.fillcolor('yellow')
    t.up()
    t.begin_fill()
    t.goto(0, -150)
    t.circle(150)
    t.down()
    t.end_fill()
    #画嘴
    #t.coler('black')
    t.pensize(3)
    t.up()
    t.goto(-70, -70)
    t.down()
    t.seth(-90)
    t.circle(70, 180)
    #画眉毛
    #画左眉
    t.pensize(2)
    t.up()
    t.goto(-40, 75)
    t.down()
    t.seth(90)
    t.circle(30, 180)
    #画右眉
    t.pensize(2)
    t.up()
    t.goto(80, 75)
    t.down()
    t.seth(90)
    t.circle(30, 180)
    #画左眼睛
    t.pensize(13)
    t.up()
    t.goto(-83, 60)
    t.down()
    t.circle(10)
    #画右眼
    t.pensize(13)
    t.up()
    t.goto(40, 60)
    t.down()
    t.circle(10)
    #尝试画鼻子
    t.pensize(3)
    t.up()
    t.goto(25, -20)
    t.down()
    t.seth(-180)
    t.forward(60)
    t.seth(60)
    t.forward(50)
    t.hideturtle()
    turtle.mainloop()
    

    python画五角星

    • 程序源代码

      import turtle
      
      t = turtle.Pen()
      t.shape('turtle')
      t.color('red')
      t.pensize(5)
      t.fillcolor('blue')
      t.begin_fill()
      for i in range(5):
          t.fd(100)
          t.left(144)
      t.end_fill()
      t.hideturtle()
      turtle.mainloop()
      

    python画正方形

    • 程序源代码

      import turtle
      
      t=turtle.Pen()
      t.shape('turtle')
      t.fillcolor('red')
      t.begin_fill()
      for i in range(4):
          t.forward(120)
          t.left(90)
      t.end_fill()
      turtle.mainloop()python画蟒蛇
      

      python画蟒蛇

      程序源代码

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

  • 相关阅读:
    Max_connect_errors – MySQL性能参数详解
    python qt
    Topo图
    ECSHOP报错误Deprecated: preg_replace(): The /e modifier is depr
    Socat
    Tomcat多次部署
    Android进程守护
    mysql将字符转换成数字
    Oracle sql查询
    ZOJ 题目2859 Matrix Searching(二维RMQ)
  • 原文地址:https://www.cnblogs.com/yafeng666/p/11722298.html
Copyright © 2011-2022 走看看