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

posted @ 2019-10-22 20:22  alen_zhan  阅读(2555)  评论(0编辑  收藏  举报
返回顶部