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

 更新时间:2019年11月23日 09:51:02   作者:yiweiyi329  
今天小编就为大家分享一篇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()#结果如下

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正则表达式高级使用方法汇总

    Python正则表达式高级使用方法汇总

    这篇文章主要介绍了Python正则表达式高级使用方法解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2020-06-06
  • python实现mean-shift聚类算法

    python实现mean-shift聚类算法

    这篇文章主要为大家详细介绍了python实现mean-shift聚类算法,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2020-06-06
  • python检测某个变量是否有定义的方法

    python检测某个变量是否有定义的方法

    这篇文章主要介绍了python检测某个变量是否有定义的方法,实例分析了Python常用的变量判定技巧,需要的朋友可以参考下
    2015-05-05
  • window下eclipse安装python插件教程

    window下eclipse安装python插件教程

    这篇文章主要为大家详细介绍了window下eclipse安装python插件教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2017-04-04
  • Python深入学习之对象的属性

    Python深入学习之对象的属性

    这篇文章主要介绍了Python深入学习之对象的属性,本文从较深的层次讲解对象属性的内部运行方式,需要的朋友可以参考下
    2014-08-08
  • Django中ORM的基本使用教程

    Django中ORM的基本使用教程

    这篇文章主要给大家介绍了关于Django中ORM基本使用的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2020-12-12
  • pytorch实现MNIST手写体识别

    pytorch实现MNIST手写体识别

    这篇文章主要为大家详细介绍了pytorch实现MNIST手写体识别,使用全连接神经网络,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2020-02-02
  • python实现udp传输图片功能

    python实现udp传输图片功能

    这篇文章主要为大家详细介绍了python实现udp传输图片功能,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2020-03-03
  • Python的基础语法和输入输出函数你都了解吗

    Python的基础语法和输入输出函数你都了解吗

    这篇文章主要为大家详细介绍了Python的基础语法和输入输出函数,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能够给你带来帮助
    2022-02-02
  • python matplotlib绘图实现删除重复冗余图例的操作

    python matplotlib绘图实现删除重复冗余图例的操作

    这篇文章主要介绍了python matplotlib绘图实现删除重复冗余图例的操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2021-04-04

最新评论