python 利用turtle库绘制笑脸和哭脸的例子

时间:2021-05-22

我就废话不多说了,直接上代码吧!

import turtleturtle.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 turtleturtle.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 turtleturtle.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库绘制笑脸和哭脸的例子就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章