python皮卡丘编程代码简单,python皮卡丘编程代码

这篇文章主要介绍了python皮卡丘字符打印代码,具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获,下面让小编带着大家一起了解一下。

7a9312c74ce44900ead4a74fcb8d5a84.png

文 | 潮汐

来源:Python 技术「ID: pythonall」

ac62263aecbbff7a42fef1a705bc65e7.png

今天是周六,祝大家周末愉快,昨天晚上小表弟来家里玩,给他看了皮卡丘动画片,突发奇想给他用 Python 画一个皮卡丘,也让他提前感受 Python 技术的强大与好玩之处,于是就有了今天的文章。

Python 画皮卡丘1
import turtle as t

def face(x, y):
    """画脸"""
    t.begin_fill()
    t.penup()
    # 将海龟移动到指定的坐标
    t.goto(x, y)
    t.pendown()
    # 设置海龟的方向
    t.setheading(40)

    t.circle(-150, 69)
    t.fillcolor("#FBD624")
    # 将海龟移动到指定的坐标

    t.penup()
    t.goto(53.14, 113.29)
    t.pendown()

    t.setheading(300)
    t.circle(-150, 30)
    t.setheading(295)
    t.circle(-140, 20)
    print(t.position())
    t.forward(5)
    t.setheading(260)
    t.circle(-80, 70)
    print(t.position())
    t.penup()
    t.goto(-74.43, -79.09)
    t.pendown()

    t.penup()
    # 将海龟移动到指定的坐标
    t.goto(-144, 103)
    t.pendown()
    t.setheading(242)
    t.circle(110, 35)
    t.right(10)
    t.forward(10)
    t.setheading(250)
    t.circle(80, 115)
    print(t.position())

    t.penup()
    t.goto(-74.43, -79.09)
    t.pendown()
    t.setheading(10)
    t.penup()
    t.goto(-144, 103)

    t.pendown()
    t.penup()
    t.goto(x, y)
    t.pendown()

    t.end_fill()

    # 下巴
    t.penup()
    t.goto(-50, -82.09)
    t.pendown()
    t.pencolor("#DDA120")
    t.fillcolor("#DDA120")
    t.begin_fill()
    t.setheading(-12)
    t.circle(120, 25)
    t.setheading(-145)
    t.forward(30)
    t.setheading(180)
    t.circle(-20, 20)
    t.setheading(143)
    t.forward(30)
    t.end_fill()
    # penup()
    # # 将海龟移动到指定的坐标
    # goto(0, 0)
    # pendown()


def eye():
    """画眼睛"""
    # 左眼
    t.color("black", "black")
    t.penup()
    t.goto(-110, 27)
    t.pendown()
    t.begin_fill()
    t.setheading(0)
    t.circle(24)
    t.end_fill()
    # 左眼仁
    t.color("white", "white")
    t.penup()
    t.goto(-105, 51)
    t.pendown()
    t.begin_fill()
    t.setheading(0)
    t.circle(10)
    t.end_fill()
    # 右眼
    t.color("black", "black")
    t.penup()
    t.goto(25, 40)
    t.pendown()
    t.begin_fill()
    t.setheading(0)
    t.circle(24)
    t.end_fill()
    # 右眼仁
    t.color("white", "white")
    t.penup()
    t.goto(17, 62)
    t.pendown()
    t.begin_fill()
    t.setheading(0)
    t.circle(10)
    t.end_fill()


def cheek():
    """画脸颊"""
    # 右边
    t.color("#9E4406", "#FE2C21")
    t.penup()
    t.goto(-130, -50)
    t.pendown()
    t.begin_fill()
    t.setheading(0)
    t.circle(27)
    t.end_fill()

    # 左边
    t.color("#9E4406", "#FE2C21")
    t.penup()
    t.goto(53, -20)
    t.pendown()
    t.begin_fill()
    t.setheading(0)
    t.circle(27)
    t.end_fill()


def nose():
    """画鼻子"""
    t.color("black", "black")
    t.penup()
    t.goto(-40, 38)
    t.pendown()
    t.begin_fill()
    t.circle(7, steps=3)
    t.end_fill()

  • 8
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值