用python画一只可爱的皮卡丘_用python画一只可爱的皮卡丘实例
效果图
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from turtle import *
'''
绘制皮卡丘头部
'''
def face(x,y):
"""画脸"""
begin_fill()
penup()
# 将海龟移动到指定的坐标
goto(x, y)
pendown()
# 设置海龟的方向
setheading(40)
circle(-150, 69)
fillcolor("#FBD624")
# 将海龟移动到指定的坐标
penup()
goto(53.14, 113.29)
pendown()
setheading(300)
circle(-150, 30)
setheading(295)
circle(-140, 20)
print(position())
forward(5)
setheading(260)
circle(-80, 70)
print(position())
penup()
goto(-74.43,-79.09)
pendown()
penup()
# 将海龟移动到指定的坐标
goto(-144,103)
pendown()
setheading(242)
circle(110, 35)
right(10)
forward(10)
setheading(250)
circle(80, 115)
print(position())
penup()
goto(-74.43,-79.09)
pendown()
setheading(10)
penup()
goto(-144, 103)
pendown()
penup()
goto(x, y)
pendown()
end_fill()
# 下巴
penup()
goto(-50, -82.09)
pendown()
pencolor("#DDA120")
fillcolor("#DDA120")
begin_fill()
setheading(-12)
circle(120, 25)
setheading(-145)
forward(30)
setheading(180)
circle(-20, 20)
setheading(143)
forward(30)
end_fill()
# penup()
# # 将海龟移动到指定的坐标
# goto(0, 0)
# pendown()
def eye():
"""画眼睛"""
# 左眼
color("black","black")
penup()
goto(-110, 27)
pendown()
begin_fill()
setheading(0)
circle(24)
end_fill()
# 左眼仁
color("white", "white")
penup()
goto(-105, 51)
pendown()
begin_fill()
setheading(0)
circle(10)
end_fill()
# 右眼
color("black", "black")
penup()
goto(25, 40)
pendown()
begin_fill()
setheading(0)
circle(24)
end_fill()
# 右眼仁
color("white", "white")
penup()
goto(17, 62)
pendown()
begin_fill()
setheading(0)
circle(10)
end_fill()
def cheek():
"""画脸颊"""
# 右边
color("#9E4406", "#FE2C21")
penup()
goto(-130, -50)
pendown()
begin_fill()
setheading(0)
circle(27)
end_fill()
# 左边
color("#9E4406", "#FE2C21")
penup()
goto(53, -20)
pendown()
begin_fill()
setheading(0)
circle(27)
end_fill()
def nose():
"""画鼻子"""
color("black", "black")
penup()
goto(-40, 38)
pendown()
begin_fill()
circle(7,steps = 3)
end_fill()
def mouth():
"""画嘴"""
color("black", "#F35590")
# 嘴唇
penup()
goto(-10, 22)
pendown()
begin_fill()
setheading(260)
forward(60)
circle(-11, 150)
forward(55)
print(position())
penup()
goto(-38.46, 21.97)
pendown()
end_fill()
# 舌头
color("#6A070D", "#6A070D")
begin_fill()
penup()
goto(-10.00, 22.00)
pendown()
penup()
goto(-14.29, -1.7)
pendown()
penup()
goto(-52, -5)
pendown()
penup()
goto(-60.40, 12.74)
pendown()
penup()
goto(-38.46, 21.97)
pendown()
penup()
goto(-10.00, 22.00)
pendown()
end_fill()
color("black","#FFD624")
penup()
goto(-78, 15)
pendown()
begin_fill()
setheading(-25)
for i in range(2):
setheading(-25)
circle(35, 70)
end_fill()
color("#AB1945", "#AB1945")
penup()
goto(-52, -5)
pendown()
begin_fill()
setheading(40)
circle(-33, 70)
goto(-16,-1.7)
penup()
goto(-18,-17)
pendown()
setheading(155)
circle(25, 70)
end_fill()
def ear():
"""画耳朵"""
# 左耳
color("black","#FFD624")
penup()
goto(-145, 93)
pendown()
begin_fill()
setheading(165)
circle(-248,50)
right(120)
circle(-248,50)
end_fill()
color("black", "black")
penup()
goto(-240, 143)
pendown()
begin_fill()
setheading(107)
circle(-170, 25)
left(80)
circle(229, 15)
left(120)
circle(300, 15)
end_fill()
# 右耳
color("black", "#FFD624")
penup()
goto(30, 136)
pendown()
begin_fill()
setheading(64)
circle(-248, 50)
right(120)
circle(-248, 50)
end_fill()
color("black", "black")
penup()
goto(160, 200)
pendown()
begin_fill()
setheading(52)
circle(170, 25)
left(116)
circle(229, 15)
left(71)
circle(-300, 15)
end_fill()
def setting():
"""设置参数"""
pensize(2)
# 隐藏海龟
hideturtle()
speed(10)
def main():
"""主函数"""
setting()
face(-132,115)
eye()
cheek()
nose()
mouth()
ear()
done()
if __name__ == '__main__':
main()
以上这篇用python画一只可爱的皮卡丘实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
用python画一只可爱的皮卡丘_用python画一只可爱的皮卡丘实例相关推荐
- python创建一个字典、关键字为只包含字母的字符串_探究Python源码,终于弄懂了字符串驻留技术...
摘要:在本文中,我们将深入研究 Python 的内部实现,并了解 Python 如何使用一种名为字符串驻留(String Interning)的技术,实现解释器的高性能. 每种编程语言为了表现出色,并 ...
- python函数和模块有什么关键特性_【Python函数与模块】(2)函数的特点
原博文 2020-04-07 22:16 − 1. 隐藏实现功能的细节 2. 提高代码的重用度 3. 提高可读性,便于调试... 相关推荐 2019-09-28 21:13 − Python pyth ...
- python整体向右缩进两个级别_关于python:IndentationError:unindent与任何外部缩进级别都不匹配...
当我编译下面的python代码时,我得到 IndentationError: unindent does not match any outer indentation level import sy ...
- python 某个数是不是在某个范围内_这个Python入门教程,国内12岁小孩都能做,是小白的入门不二之选...
简介:你曾经想知道计算机是如何工作的吗?尽管我们不能在一篇文章里面教会你所有的东西,但是可以通过学习如何写出你自己的程序来获得一个良好的开端.在这篇Python教程中,你将会学到计算机编程的基础知识, ...
- python是什么学了有什么用处_学python有什么用途 就业方向有哪些
学习完python以后有很多用途,比如可以做Web开发.网络爬虫.数据分析.服务器运维.python自动化测试等工作,就业方向很多,就业前景也非常好. 学完python的就业方向 1.Web开发,我们 ...
- python中以下关于列表描述错误的_在Python中,以下关于函数的描述错误的是哪一项?...
[判断题]Python内置函数len____可以返回列表.元组.字典.集合.字符串以及range对象中元素个数. [判断题]Python内置函数max____用来返回序列中的最大元素. [判断题]Py ...
- python与其他的数据分析有什么区别_学好python和数据分析有什么关系?
1. 应用数学.统计学.金融学等相关专业,硕士及以上学历. 2. 有良好的产品Sense和商业敏感度,有2年以上电商.物流.零售等数据分析经验. 3. 精通SQL,有一定的Python或者R编程能力, ...
- python请输入星期几的第一个字母来判断_【Python 实例】面向对象 | 请输入一周中某天的名称的第一个字母来判断以下是星期几,如果第一个字母一样则继续判断第二个字母...
[Python 实例]面向对象 | 请输入一周中某天的名称的第一个字母来判断以下是星期几,如果第一个字母一样则继续判断第二个字母 题目: 请输入一周中某天的名称的第一个字母来判断以下是星期几,如果第一 ...
- python可以实现什么炫酷图形吗_我是Python小玩家,一行代码能做哪些炫酷的事情?...
python之禅 image 一行代码启动一个Web服务 python -m SimpleHTTPServer 8080 python3 -m http.server 8080 一行代码实现变量值互换 ...
- 树莓派python编程入门与实战解压密码_树莓派Python编程入门与实战
目录 第一部分 树莓派编程环境 第1章 配置树莓派 3 1.1 获取树莓派 3 1.1.1 了解树莓派的历史 3 1.1.2 为什么要学习用Python 在树莓派上进行编程 4 1.2 获取树莓派 5 ...
最新文章
- php 操作txt,PHP 从txt文件中读取数据
- 释放C盘空间27招具体优化技巧
- 从零打造在线网盘系统之Hibernate查询与更新技术
- 天刀服务器维护时间,6月3日服务器例行维护公告(已完成)
- 贴一段自动编译java,并混淆编译的代码
- Head First summary
- html之特殊字符表
- datatable刷新数据_UE4 利用SaveGame和CSV进行Runtime数据更新
- 小熊的人生回忆(一)
- 硬币最小数量java
- TypeScript--函数
- Python之旅:集合
- Transparent Tribe行动
- 面试必备 | 带你彻底搞懂 Python 生成器。
- Unity3D说明文档翻译-Physics Manager
- 【Opencv实战】美颜模式,开启:美颜功能都这么强大了嘛?(群魔乱舞.jpg)
- window.print() 实现A4纸张打印及去掉页眉页脚及打印链接
- python库吐血整理
- 国内镜像大全(部分)
- 图像特征(二)——形状特征(主轮廓特征、区域特征、图像的矩及Hu矩)
热门文章
- vmware用户名和密码_VMWare vijava –“用户名或密码不正确”异常的奇怪情况
- apache spark_Apache Spark中的自定义日志
- packt_Packt发行的$ 5 Java编程书籍:精通Java 9,Java 9高性能
- 敏捷中gwt含义_在GWT中序列化/反序列化Json
- java ee7帮助文档_帮助推动Java EE向前发展
- junit5和junit4_JUnit 5 –设置
- 带有AngularJS资源的Spring Rest Controller
- java常见_关于Java的常见误解
- JDK 8 BigInteger精确缩小转换方法
- 具有CDI和lambda的策略模式