温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

python如何利用turtle库绘制笑脸和哭脸

发布时间:2021-05-19 11:03:38 来源:亿速云 阅读:977 作者:小新 栏目:开发技术

这篇文章给大家分享的是有关python如何利用turtle库绘制笑脸和哭脸的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

代码:

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()#结果如下

python如何利用turtle库绘制笑脸和哭脸

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()#结果如下

python如何利用turtle库绘制笑脸和哭脸

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的五大特点是什么

python的五大特点:1.简单易学,开发程序时,专注的是解决问题,而不是搞明白语言本身。2.面向对象,与其他主要的语言如C++和Java相比, Python以一种非常强大又简单的方式实现面向对象编程。3.可移植性,Python程序无需修改就可以在各种平台上运行。4.解释性,Python语言写的程序不需要编译成二进制代码,可以直接从源代码运行程序。5.开源,Python是 FLOSS(自由/开放源码软件)之一。

感谢各位的阅读!关于“python如何利用turtle库绘制笑脸和哭脸”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI