欢迎来到今天的讨论,我们将探讨,基于arcgis的python编程秘笈(第2版) 基于arcgis的python编程秘笈 下载,让我们开始吧!
这篇文章主要介绍了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
原文地址1:https://blog.csdn.net/2401_83157073/article/details/136619949
参考资料:python中用turtle画一个圆形 https://blog.csdn.net/SXIAOYAN_/article/details/140061099