本文目录:小猪佩奇-落叶树-魔法少女
本文作者:小赖同学
最近在浏览Python文章时,无意中发现了一个好玩的画图工具turtle,看到各路大神竟然用Python画了一个图片出来,无法用言语来形容心中感概,只能重复默念“卧槽卧槽厉害”。为了丰富大家的娱乐时间,我进行了汇总,整理出三个比较好看的给大家消磨时间。
小猪佩奇
效果图:
代码:
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2020/3/13 20:00
# @Author : Lucas Lai
# @IDE: PyCharm
import turtle as tt
def nose():
# 鼻子
tt.pu()
tt.goto(-100, 100)
tt.pd()
tt.seth(-30)
tt.begin_fill()
a = 0.4
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.08
tt.lt(3) # 向左转3度
tt.fd(a) # 向前走a的步长
else:
a = a - 0.08
tt.lt(3)
tt.fd(a)
tt.end_fill()
tt.pu()
tt.seth(90)
tt.fd(25)
tt.seth(0)
tt.fd(10)
tt.pd()
tt.pencolor(255, 155, 192)
tt.seth(10)
tt.begin_fill()
tt.circle(5)
tt.color(160, 82, 45)
tt.end_fill()
tt.pu()
tt.seth(0)
tt.fd(20)
tt.pd()
tt.pencolor(255, 155, 192)
tt.seth(10)
tt.begin_fill()
tt.circle(5)
tt.color(160, 82, 45)
tt.end_fill()
def head():
# 头
tt.color((255, 155, 192), "pink")
tt.pu()
tt.seth(90)
tt.fd(41)
tt.seth(0)
tt.fd(0)
tt.pd()
tt.begin_fill