python 利用turtle库绘制笑脸和哭脸的例子
(编辑:jimmy 日期: 2024/11/20 浏览:3 次 )
我就废话不多说了,直接上代码吧!
import turtle turtle.pensize(5) turtle.pencolor("yellow") turtle.fillcolor("red") turtle.penup() turtle.goto(0,-200) turtle.pendown() turtle.circle(200) turtle.penup() turtle.goto(-100,50) turtle.pendown() turtle.begin_fill() turtle.circle(17.5) turtle.end_fill() turtle.penup() turtle.goto(100,50) turtle.pendown() turtle.begin_fill() turtle.circle(17.5) turtle.end_fill() turtle.penup() turtle.goto(0,50) turtle.pendown() turtle.circle(-70,steps=3) turtle.penup() turtle.goto(-100,-70) turtle.pendown() turtle.right(90) turtle.circle(100,180) turtle.mainloop()#结果如下
import turtle turtle.pensize(5) turtle.pencolor("green") turtle.fillcolor("red") turtle.penup() turtle.goto(0,-200) turtle.pendown() turtle.circle(200) turtle.penup() turtle.goto(-100,50) turtle.pendown() turtle.begin_fill() turtle.circle(17.5) turtle.end_fill() turtle.penup() turtle.goto(100,50) turtle.pendown() turtle.begin_fill() turtle.circle(17.5) turtle.end_fill() turtle.penup() turtle.goto(0,50) turtle.pendown() turtle.circle(-70,steps=3) turtle.penup() turtle.goto(-50,-120) turtle.pendown() turtle.left(90) turtle.circle(-50,180) turtle.mainloop()#结果如下
import turtle turtle.pensize(5) turtle.pencolor("green") turtle.fillcolor("red") turtle.penup() turtle.goto(0,-200) turtle.pendown() turtle.circle(200) turtle.penup() turtle.goto(-100,50) turtle.pendown() turtle.begin_fill() turtle.circle(17.5) turtle.end_fill() turtle.penup() turtle.goto(100,50) turtle.pendown() turtle.begin_fill() turtle.circle(17.5) turtle.end_fill() turtle.penup() turtle.goto(0,50) turtle.pendown() turtle.circle(-70,steps=3) turtle.penup() turtle.goto(-100,-120) turtle.pendown() turtle.left(90) turtle.circle(-25,180) turtle.left(180) turtle.circle(-25,180) turtle.left(180) turtle.circle(-25,180) turtle.left(180) turtle.circle(-25,180) turtle.mainloop()#结果如下
以上这篇python 利用turtle库绘制笑脸和哭脸的例子就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
下一篇:Python使用Turtle库绘制一棵西兰花