废话不多说,直接上图
import turtle
def getPosition(x, y):
turtle.setx(x)
turtle.sety(y)
print(x, y)
class Pikachu:
def __init__(self):
self.t = turtle.Turtle()
t = self.t
t.pensize(3)
t.speed(9)
t.ondrag(getPosition)
def noTrace_goto(self, x, y):
self.t.penup()
self.t.goto(x, y)
self.t.pendown()
def leftEye(self, x, y):
self.noTrace_goto(x, y)
t = self.t
t.seth(0)
t.fillcolor('#333333')
t.begin_fill()
t.circle(22)
t.end_fill()
self.noTrace_goto(x, y + 10)
t.fillcolor('#000000')
t.begin_fill()
t.circle(10)
t.end_fill()
self.noTrace_goto(x + 6, y + 22)
t.fillcolor('#ffffff')
t.begin_fill()
t.circle(10)
t.end_fill()
def rightEye(self, x, y):
self.noTrace_goto(x, y)
t = self.t
t.seth(0)
t.fillcolor('#333333')
t.begin_fill()
t.circle(22)
t.end_fill()
self.noTrace_goto(x, y + 10)
t.fillcolor('#000000')
t.begin_fill()
t.circle(10)
t.end_fill()
self.noTrace_goto(x - 6, y + 22)
t.fillcolor('#ffffff')
t.begin_fill()
t.circle(10)
t.end_fill()
def mouth(self, x, y):
self.noTrace_goto(x, y)
t = self.t
t.fillcolor('#88141D')
t.begin_fill()
# 下嘴唇
l1 = []
l2 = []
t.seth(190)
a = 0.7
for i in range(28):
a += 0.1
t.right(3)
t.fd(a)
l1.append(t.position())
self.noTrace_goto(x, y)
t.seth(10)
a = 0.7
for i in range(28):
a += 0.1
t.left(3)
t.fd(a)
l2.append(t.position())
# 上嘴唇
t.seth(10)
t.circle(50, 15)
t.left(180)
t.circle(-50, 15)
t.circle(-50, 40)
t.seth(233)
t.circle(-50, 55)
t.left(180)
t.circle(50, 12.1)
t.end_fill()
# 舌头
self.noTrace_goto(17, 54)
t.fillcolor('#DD716F')
t.begin_fill()
t.seth(145)
t.circle(40, 86)
t.penup()
for pos in reversed(l1[:20]):
t.goto(pos[0], pos[1] + 1.5)
for pos in l2[:20]:
t.goto(pos[0], pos[1] + 1.5)
t.pendown()
t.end_fill()
# 鼻子
self.noTrace_goto(-17, 94)
t.seth(8)
t.fd(4)
t.back(8)
# 红脸颊
def leftCheek(self, x, y):
turtle.tracer(False)
t = self.t
self.noTrace_goto(x, y)
t.seth(300)
t.fillcolor('#DD4D28')
t.begin_fill()
a = 2.3
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a -= 0.05
t.lt(3)
t.fd(a)
else:
a += 0.05
t.lt(3)
t.fd(a)
t.end_fill()
turtle.tracer(True)
def rightCheek(self, x, y):
t = self.t
turtle.tracer(False)
self.noTrace_goto(x, y)
t.seth(60)
t.fillcolor('#DD4D28')
t.begin_fill()
a = 2.3
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a -= 0.05
t.lt(3)
t.fd(a)
else:
a += 0.05
t.lt(3)
t.fd(a)
t.end_fill()
turtle.tracer(True)
def colorLeftEar(self, x, y):
t = self.t
self.noTrace_goto(x, y)
t.fillcolor('#000000')
t.begin_fill()
t.seth(330)
t.circle(100, 35)
t.seth(219)
t.circle(-300, 19)
t.seth(110)
t.circle(-30, 50)
t.circle(-300, 10)
t.end_fill()
def colorRightEar(self, x, y):
t = self.t
self.noTrace_goto(x, y)
t.fillcolor('#000000')
t.begin_fill()
t.seth(300)
t.circle(-100, 30)
t.seth(35)
t.circle(300, 15)
t.circle(30, 50)
t.seth(190)
t.circle(300, 17)
t.end_fill()
def body(self):
t = self.t
t.fillcolor('#F6D02F')
t.begin_fill()
# 右脸轮廓
t.penup()
t.circle(130, 40)
t.pendown()
t.circle(100, 105)
t.left(180)
t.circle(-100, 5)
# 右耳朵
t.seth(20)
t.circle(300, 30)
t.circle(30, 50)
t.seth(190)
t.circle(300, 36)
# 上轮廓
t.seth(150)
t.circle(150, 70)
# 左耳朵
t.seth(200)
t.circle(300, 40)
t.circle(30, 50)
t.seth(20)
t.circle(300, 35)
# print(t.pos())
# 左脸轮廓
t.seth(240)
t.circle(105, 95)
t.left(180)
t.circle(-105, 5)
# 左手
t.seth(210)
t.circle(500, 18)
t.seth(200)
t.fd(10)
t.seth(280)
t.fd(7)
t.seth(210)
t.fd(10)
t.seth(300)
t.circle(10, 80)
t.seth(220)
t.fd(10)
t.seth(300)
t.circle(10, 80)
t.seth(240)
t.fd(12)
t.seth(0)
t.fd(13)
t.seth(240)
t.circle(10, 70)
t.seth(10)
t.circle(10, 70)
t.seth(10)
t.circle(300, 18)
t.seth(75)
t.circle(500, 8)
t.left(180)
t.circle(-500, 15)
t.seth(250)
t.circle(100, 65)
# 左脚
t.seth(320)
t.circle(100, 5)
t.left(180)
t.circle(-100, 5)
t.seth(220)
t.circle(200, 20)
t.circle(20, 70)
t.seth(60)
t.circle(-100, 20)
t.left(180)
t.circle(100, 20)
t.seth(300)
t.circle(10, 70)
t.seth(60)
t.circle(-100, 20)
t.left(180)
t.circle(100, 20)
t.seth(10)
t.circle(100, 60)
# 横向
t.seth(180)
t.circle(-100, 10)
t.left(180)
t.circle(100, 10)
t.seth(5)
t.circle(100, 10)
t.circle(-100, 40)
t.circle(100, 35)
t.left(180)
t.circle(-100, 10)
# 右脚
t.seth(290)
t.circle(100, 55)
t.circle(10, 50)
t.seth(120)
t.circle(100, 20)
t.left(180)
t.circle(-100, 20)
t.seth(0)
t.circle(10, 50)
t.seth(110)
t.circle(100, 20)
t.left(180)
t.circle(-100, 20)
t.seth(30)
t.circle(20, 50)
t.seth(100)
t.circle(100, 40)
# 右侧身体轮廓
t.seth(200)
t.circle(-100, 5)
t.left(180)
t.circle(100, 5)
t.left(30)
t.circle(100, 75)
t.right(15)
t.circle(-300, 21)
t.left(180)
t.circle(300, 3)
# 右手
t.seth(43)
t.circle(200, 60)
t.right(10)
t.fd(10)
t.circle(5, 160)
t.seth(90)
t.circle(5, 160)
t.seth(90)
t.fd(10)
t.seth(90)
t.circle(5, 180)
t.fd(10)
t.left(180)
t.left(20)
t.fd(10)
t.circle(5, 170)
t.fd(10)
t.seth(240)
t.circle(50, 30)
t.end_fill()
self.noTrace_goto(130, 125)
t.seth(-20)
t.fd(5)
t.circle(-5, 160)
t.fd(5)
# 手指纹
self.noTrace_goto(166, 130)
t.seth(-90)
t.fd(3)
t.circle(-4, 180)
t.fd(3)
t.seth(-90)
t.fd(3)
t.circle(-4, 180)
t.fd(3)
# 尾巴
self.noTrace_goto(168, 134)
t.fillcolor('#F6D02F')
t.begin_fill()
t.seth(40)
t.fd(200)
t.seth(-80)
t.fd(150)
t.seth(210)
t.fd(150)
t.left(90)
t.fd(100)
t.right(95)
t.fd(100)
t.left(110)
t.fd(70)
t.right(110)
t.fd(80)
t.left(110)
t.fd(30)
t.right(110)
t.fd(32)
t.right(106)
t.circle(100, 25)
t.right(15)
t.circle(-300, 2)
##############
# print(t.pos())
t.seth(30)
t.fd(40)
t.left(100)
t.fd(70)
t.right(100)
t.fd(80)
t.left(100)
t.fd(46)
t.seth(66)
t.circle(200, 38)
t.right(10)
t.fd(10)
t.end_fill()
# 尾巴花纹
t.fillcolor('#923E24')
self.noTrace_goto(126.82, -156.84)
t.begin_fill()
t.seth(30)
t.fd(40)
t.left(100)
t.fd(40)
t.pencolor('#923e24')
t.seth(-30)
t.fd(30)
t.left(140)
t.fd(20)
t.right(150)
t.fd(20)
t.left(150)
t.fd(20)
t.right(150)
t.fd(20)
t.left(130)
t.fd(18)
t.pencolor('#000000')
t.seth(-45)
t.fd(67)
t.right(110)
t.fd(80)
t.left(110)
t.fd(30)
t.right(110)
t.fd(32)
t.right(106)
t.circle(100, 25)
t.right(15)
t.circle(-300, 2)
t.end_fill()
# 帽子、眼睛、嘴巴、脸颊
self.cap(-134.07, 147.81)
self.mouth(-5, 25)
self.leftCheek(-126, 32)
self.rightCheek(107, 63)
self.colorLeftEar(-250, 100)
self.colorRightEar(140, 270)
self.leftEye(-85, 90)
self.rightEye(50, 110)
t.hideturtle()
def cap(self, x, y):
self.noTrace_goto(x, y)
t = self.t
t.fillcolor('#CD0000')
t.begin_fill()
t.seth(200)
t.circle(400, 7)
t.left(180)
t.circle(-400, 30)
t.circle(30, 60)
t.fd(50)
t.circle(30, 45)
t.fd(60)
t.left(5)
t.circle(30, 70)
t.right(20)
t.circle(200, 70)
t.circle(30, 60)
t.fd(70)
# print(t.pos())
t.right(35)
t.fd(50)
t.circle(8, 100)
t.end_fill()
self.noTrace_goto(-168.47, 185.52)
t.seth(36)
t.circle(-270, 54)
t.left(180)
t.circle(270, 27)
t.circle(-80, 98)
t.fillcolor('#444444')
t.begin_fill()
t.left(180)
t.circle(80, 197)
t.left(58)
t.circle(200, 45)
t.end_fill()
self.noTrace_goto(-58, 270)
t.pencolor('#228B22')
t.dot(35)
self.noTrace_goto(-30, 280)
t.fillcolor('#228B22')
t.begin_fill()
t.seth(100)
t.circle(30, 180)
t.seth(190)
t.fd(15)
t.seth(100)
t.circle(-45, 180)
t.right(90)
t.fd(15)
t.end_fill()
t.pencolor('#000000')
def start(self):
self.body()
def main():
print('Painting the Pikachu... ')
turtle.screensize(800, 600)
turtle.title('Pikachu')
pikachu = Pikachu()
pikachu.start()
turtle.mainloop()
if __name__ == '__main__':
main()
import turtle as t
import time
def tcyuan(x, y, r):
t.fillcolor("black")
t.begin_fill()
t.seth(0)
y = y - r
t.penup()
t.goto(x, y)
t.pendown()
t.circle(r)
t.end_fill()
def yuan(x, y, r):
t.seth(0)
y = y - r
t.penup()
t.goto(x, y)
t.pendown()
t.circle(r)
def yueliang():
R = 110 - 1
r = R - 22 - 1
# 月亮填充
t.penup()
t.goto(-350 + 2 * R, 0)
t.seth(90)
t.fillcolor("black")
t.begin_fill()
t.circle(R, 359)
t.left(90)
t.fd(2)
t.left(90)
t.circle(-r, 359)
t.left(90)
t.fd(2)
t.pendown()
t.end_fill()
# 轮廓
yuan(-350 + R, 0, R)
yuan(-350 + 44 + r - 2, 0, r - 2)
def zhixian(R, r, count, jiaodu):
t.seth(90 + jiaodu)
# t.goto(0, 0)
for i in range(count):
t.penup()
t.goto(0, 0)
t.fd(r)
t.pendown()
t.fd(R - r)
t.left(360 / count)
def zfx(R, r):
jiange = 10
# t.pensize(jiange)
t.seth(90)
big = pow((R ** 2) * 2, 0.5)
small = big - 2 * jiange
for i in range(13):
# 大线
t.penup()
t.goto(0, 0)
t.fd(R)
t.pendown()
t.right(135)
t.fd(big)
# 小线
t.left(135)
t.penup()
t.goto(0, 0)
t.fd(pow((small ** 2) / 2, 0.5))
t.pendown()
t.right(135)
t.fd(small)
# 粗线
t.pensize(8)
t.pencolor("black")
t.left(135)
t.penup()
t.goto(0, 0)
t.fd((R + pow((small ** 2) / 2, 0.5)) / 2)
t.pendown()
t.right(135)
t.fd((big + small) / 2)
t.pensize(2)
t.pencolor("yellow")
t.seth(90 + i * 30)
else:
# 大线
t.penup()
t.goto(0, 0)
t.fd(R)
t.right(135)
t.fd(big / 2)
t.pendown()
t.fd(big / 2)
# 小线
t.left(135)
t.penup()
t.goto(0, 0)
t.fd(pow((small ** 2) / 2, 0.5))
t.right(135)
t.fd(small / 2)
t.pendown()
t.fd(small / 2)
# 粗线
t.pensize(8)
t.pencolor("black")
t.left(135)
t.penup()
t.goto(0, 0)
t.fd((R + pow((small ** 2) / 2, 0.5)) / 2)
t.right(135)
t.fd((big + small) / 2 / 2)
t.pendown()
t.fd((big + small) / 2 / 2)
t.pensize(2)
t.pencolor("yellow")
t.seth(90 + i * 30)
def wjx(r, jiaodu):
t.fillcolor("black")
t.penup()
t.goto(0, 0)
t.seth(90 + jiaodu)
t.fd(r)
t.pendown()
t.right(18)
t.begin_fill()
for i in range(5):
t.right(144)
t.forward(144)
t.left(72)
t.forward(144)
t.end_fill()
if jiaodu != 0:
t.seth(90 + jiaodu)
for i in range(1, 6):
t.penup()
t.goto(0, 0)
t.left(72)
t.pendown()
t.fd(r)
def xingzuo():
r = 250
t.penup()
t.goto(20, -35)
t.seth(-45)
t.fd(r)
t.pendown()
xz = ['♒', '♓', '♈', '♉', '♌', '♍', '♎', '♏']
for i in range(4):
t.write(xz[i], font=("", 20, ""))
t.penup()
t.right(90)
t.circle(-300, 30)
t.left(90)
t.pendown()
t.penup()
t.goto(-r / 4 + 10, 5)
t.seth(135)
t.fd(r)
for i in range(4, 8):
t.write(xz[i], font=("", 20, ""))
t.penup()
t.right(90)
t.circle(-300, 30)
t.left(90)
t.pendown()
def dxnb(s):
t.penup()
t.fd(-19)
t.left(90)
t.fd(2)
t.pendown()
t.write(s, font=["KaiTi", 30, "bold"])
def taiyang():
def haicao(r, i):
# 海藻
t.fillcolor("black")
t.penup()
if i == 0:
t.goto(256, r)
elif i == 1:
t.goto(256 - r, 0)
else:
t.goto(256, -r)
t.pendown()
t.begin_fill()
t.seth(2 + i * 90)
t.circle(r / 2, 105)
t.left(10)
t.circle(-r / 3, 90)
t.circle(r / 3, 60)
t.left(20)
t.circle(r / 3, -80)
t.left(50)
t.circle(-r + 10, -40)
t.right(30)
t.circle(r / 2 + 10, -50)
t.penup()
if i == 0:
t.goto(256, r)
elif i == 1:
t.goto(256 - r, 0)
else:
t.goto(256, -r)
t.pendown()
t.end_fill()
t.seth(2 + i * 90)
t.circle(r / 2, 105)
t.left(10)
t.circle(-r / 3, 90)
t.begin_fill()
t.circle(r / 3, 60)
t.left(20)
t.circle(r / 3, -80)
t.left(50)
t.circle(-r + 10, -40)
t.right(30)
t.circle(r / 2 + 10, -50)
t.right(30)
t.circle(r / 2 - 2, 110)
t.circle(-r / 3, 70)
t.left(7)
t.circle(r / 3, 85)
t.end_fill()
t.penup()
if i == 0:
t.goto(256, r)
t.pendown()
t.seth(180 - (2 + i * 90))
t.circle(-(r / 2), 105)
elif i == 1:
t.goto(256 - r, 0)
t.pendown()
t.seth(- (2 + i * 90))
t.circle(-(r / 2), 105)
else:
t.goto(256, -r)
t.pendown()
t.seth(180 - (2 + i * 90))
t.circle(-(r / 2), 105)
t.begin_fill()
t.left(-10)
t.circle(-(-r / 3), 90)
t.circle(-(r / 3), 60)
t.left(-20)
t.circle(-(r / 3), -80)
t.left(-50)
t.circle(-(-r + 10), -40)
t.right(-30)
t.circle(-(r / 2 + 10), -50)
t.end_fill()
t.penup()
if i == 0:
t.goto(256, r)
t.pendown()
t.seth(180 - (2 + i * 90))
t.circle(-(r / 2), 105)
elif i == 1:
t.goto(256 - r, 0)
t.pendown()
t.seth(- (2 + i * 90))
t.circle(-(r / 2), 105)
else:
t.goto(256, -r)
t.pendown()
t.seth(180 - (2 + i * 90))
t.circle(-(r / 2), 105)
t.pendown()
t.left(-10)
t.circle(-(-r / 3), 90)
t.circle(-(r / 3), 60)
t.left(-20)
t.begin_fill()
t.circle(-(r / 3), -80)
t.left(-50)
t.circle(-(-r + 10), -40)
t.right(-30)
t.circle(-(r / 2 + 10), -50)
t.right(-30)
t.circle(-(r / 2 - 2), 110)
t.circle(-(-r / 3), 70)
t.left(-7)
t.circle(-(r / 3), 85)
t.end_fill()
def xhaicao(r, i):
t.penup()
t.goto(256 + r, 0)
t.seth(-90)
t.circle(-r, 20)
t.pendown()
t.begin_fill()
t.seth(30)
t.circle(-r / 3, 100)
t.circle(r / 6, 140)
t.circle(-r / 11, 100)
t.left(80)
t.circle(-r / 2, -30)
t.circle(r / 4, -140)
t.circle(-r / 3, -60)
t.end_fill()
t.penup()
t.goto(256 + r, 0)
t.seth(-90)
t.circle(-r, 30)
t.pendown()
t.seth(45)
t.circle(-r / 4, 100)
t.right(20)
t.circle(r / 4, 140)
t.right(10)
t.circle(-r / 11, 90)
t.penup()
t.goto(256 + r, 0)
t.seth(90)
t.circle(r, 20)
t.pendown()
t.begin_fill()
t.seth(-30)
t.circle(-(-r / 3), 100)
t.circle(-(r / 6), 140)
t.circle(-(-r / 11), 100)
t.left(-80)
t.circle(-(-r / 2), -30)
t.circle(-(r / 4), -140)
t.circle(-(-r / 3), -60)
t.end_fill()
t.penup()
t.goto(256 + r, 0)
t.seth(90)
t.circle(r, 30)
t.pendown()
t.seth(-45)
t.circle(-(-r / 4), 100)
t.right(-25)
t.circle(-(r / 4), 140)
t.right(-10)
t.circle(-(-r / 11), 90)
r = 50
# 海藻
haicao(r, 0)
haicao(r, 1)
haicao(r, 2)
xhaicao(r, 3)
# 大三角形
t.fillcolor("black")
for i in range(1, 4):
temp = 3
t.penup()
t.goto(256, 0)
t.seth(i * 90)
t.pendown()
t.begin_fill()
t.right(22.5)
t.fd(r)
if i == 1:
t.goto(256, 3 * r - temp)
t.goto(256, 0)
t.seth(i * 90 + 22.5)
t.fd(r)
t.goto(256, 3 * r - temp)
elif i == 2:
t.goto(256 - 3 * r + temp, 0)
t.goto(256, 0)
t.seth(i * 90 + 22.5)
t.fd(r)
t.goto(256 - 3 * r + temp, 0)
else:
t.goto(256, -3 * r + temp)
t.goto(256, 0)
t.seth(i * 90 + 22.5)
t.fd(r)
t.goto(256, -3 * r + temp)
t.end_fill()
# 小三角形
x = pow(((2 * r) ** 2) / 2, 0.5) - 8
for i in range(1, 5):
t.penup()
t.goto(256, 0)
t.seth(i * 90)
t.pendown()
t.begin_fill()
t.right(22.5)
t.fd(r)
if i == 1:
t.goto(256 + x, x)
t.goto(256, 0)
t.right(45)
t.fd(r)
t.goto(256 + x, x)
elif i == 2:
t.goto(256 - x, x)
t.goto(256, 0)
t.right(45)
t.fd(r)
t.goto(256 - x, x)
elif i == 3:
t.goto(256 - x, -x)
t.goto(256, 0)
t.right(45)
t.fd(r)
t.goto(256 - x, -x)
else:
t.goto(256 + x, -x)
t.goto(256, 0)
t.right(45)
t.fd(r)
t.goto(256 + x, -x)
t.end_fill()
# 圆
# t.begin_fill()
tcyuan(256, 0, r)
# 初始化
t.setup(1500, 800, 0, 0)
t.speed(0)
t.bgcolor("black")
t.pencolor("yellow")
t.pensize(2)
# 最大的圆
yuan(0, 0, 350)
yuan(0, 0, 325)
yuan(0, 0, 321)
yuan(0, 0, 306)
zhixian(321, 306, 72, 0)
# 小圆
yuan(0, 0, 204)
yuan(0, 0, 200)
yuan(0, 0, 186)
zhixian(200, 186, 72, 0)
# 正方形边框以及直线
zhixian(290, 213, 12, 0)
zhixian(248, 205, 12, 15)
zfx(306, 204)
# 里五角星
wjx(200, 36)
# 月亮
yueliang()
# 太阳
taiyang()
# 最小圆
tcyuan(0, 328, 22)
dxnb("北")
tcyuan(0, -328, 22)
dxnb("南")
tcyuan(-328, 0, 22)
dxnb("西")
tcyuan(328, 0, 22)
dxnb("東")
xingzuo()
#展示
time.sleep(30) #展示时间30s
import turtle as t
t.pensize(4)
t.hideturtle()
t.colormode(255)
t.color((255, 155, 192), "pink")
t.setup(840, 500)
t.speed(20)
# 鼻子
t.pu()
t.goto(-100, 100)
t.pd()
t.seth(-30)
t.begin_fill()
a = 0.4
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.08
t.lt(3) # 向左转3度
t.fd(a) # 向前走a的步长
else:
a = a - 0.08
t.lt(3)
t.fd(a)
t.end_fill()
t.pu()
t.seth(90)
t.fd(25)
t.seth(0)
t.fd(10)
t.pd()
t.pencolor(255, 155, 192)
t.seth(10)
t.begin_fill()
t.circle(5)
t.color(160, 82, 45)
t.end_fill()
t.pu()
t.seth(0)
t.fd(20)
t.pd()
t.pencolor(255, 155, 192)
t.seth(10)
t.begin_fill()
t.circle(5)
t.color(160, 82, 45)
t.end_fill()
# 头
t.color((255, 155, 192), "pink")
t.pu()
t.seth(90)
t.fd(41)
t.seth(0)
t.fd(0)
t.pd()
t.begin_fill()
t.seth(180)
t.circle(300, -30)
t.circle(100, -60)
t.circle(80, -100)
t.circle(150, -20)
t.circle(60, -95)
t.seth(161)
t.circle(-300, 15)
t.pu()
t.goto(-100, 100)
t.pd()
t.seth(-30)
a = 0.4
for i in range(60):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.08
t.lt(3) # 向左转3度
t.fd(a) # 向前走a的步长
else:
a = a - 0.08
t.lt(3)
t.fd(a)
t.end_fill()
# 耳朵
t.color((255, 155, 192), "pink")
t.pu()
t.seth(90)
t.fd(-7)
t.seth(0)
t.fd(70)
t.pd()
t.begin_fill()
t.seth(100)
t.circle(-50, 50)
t.circle(-10, 120)
t.circle(-50, 54)
t.end_fill()
t.pu()
t.seth(90)
t.fd(-12)
t.seth(0)
t.fd(30)
t.pd()
t.begin_fill()
t.seth(100)
t.circle(-50, 50)
t.circle(-10, 120)
t.circle(-50, 56)
t.end_fill()
# 眼睛
t.color((255, 155, 192), "white")
t.pu()
t.seth(90)
t.fd(-20)
t.seth(0)
t.fd(-95)
t.pd()
t.begin_fill()
t.circle(15)
t.end_fill()
t.color("black")
t.pu()
t.seth(90)
t.fd(12)
t.seth(0)
t.fd(-3)
t.pd()
t.begin_fill()
t.circle(3)
t.end_fill()
t.color((255, 155, 192), "white")
t.pu()
t.seth(90)
t.fd(-25)
t.seth(0)
t.fd(40)
t.pd()
t.begin_fill()
t.circle(15)
t.end_fill()
t.color("black")
t.pu()
t.seth(90)
t.fd(12)
t.seth(0)
t.fd(-3)
t.pd()
t.begin_fill()
t.circle(3)
t.end_fill()
# 腮
t.color((255, 155, 192))
t.pu()
t.seth(90)
t.fd(-95)
t.seth(0)
t.fd(65)
t.pd()
t.begin_fill()
t.circle(30)
t.end_fill()
# 嘴
t.color(239, 69, 19)
t.pu()
t.seth(90)
t.fd(15)
t.seth(0)
t.fd(-100)
t.pd()
t.seth(-80)
t.circle(30, 40)
t.circle(40, 80)
# 身体
t.color("red", (255, 99, 71))
t.pu()
t.seth(90)
t.fd(-20)
t.seth(0)
t.fd(-78)
t.pd()
t.begin_fill()
t.seth(-130)
t.circle(100, 10)
t.circle(300, 30)
t.seth(0)
t.fd(230)
t.seth(90)
t.circle(300, 30)
t.circle(100, 3)
t.color((255, 155, 192), (255, 100, 100))
t.seth(-135)
t.circle(-80, 63)
t.circle(-150, 24)
t.end_fill()
# 手
t.color((255, 155, 192))
t.pu()
t.seth(90)
t.fd(-40)
t.seth(0)
t.fd(-27)
t.pd()
t.seth(-160)
t.circle(300, 15)
t.pu()
t.seth(90)
t.fd(15)
t.seth(0)
t.fd(0)
t.pd()
t.seth(-10)
t.circle(-20, 90)
t.pu()
t.seth(90)
t.fd(30)
t.seth(0)
t.fd(237)
t.pd()
t.seth(-20)
t.circle(-300, 15)
t.pu()
t.seth(90)
t.fd(20)
t.seth(0)
t.fd(0)
t.pd()
t.seth(-170)
t.circle(20, 90)
# 脚
t.pensize(10)
t.color((240, 128, 128))
t.pu()
t.seth(90)
t.fd(-75)
t.seth(0)
t.fd(-180)
t.pd()
t.seth(-90)
t.fd(40)
t.seth(-180)
t.color("black")
t.pensize(15)
t.fd(20)
t.pensize(10)
t.color((240, 128, 128))
t.pu()
t.seth(90)
t.fd(40)
t.seth(0)
t.fd(90)
t.pd()
t.seth(-90)
t.fd(40)
t.seth(-180)
t.color("black")
t.pensize(15)
t.fd(20)
# 尾巴
t.pensize(4)
t.color((255, 155, 192))
t.pu()
t.seth(90)
t.fd(70)
t.seth(0)
t.fd(95)
t.pd()
t.seth(0)
t.circle(70, 20)
t.circle(10, 330)
t.circle(70, 30)
t.exitonclick()
from turtle import *
import time
screensize(650, 500, "yellow")
setup(800, 550)
penup()
goto(-185, 65)
pendown()
pensize(5)
color("black")
begin_fill()
circle(50, 360)
end_fill()
penup()
goto(-210, 110)
pendown()
pensize(5)
color("white")
begin_fill()
circle(20, 360)
end_fill()
penup()
goto(185, 65)
pendown()
pensize(5)
color("black")
begin_fill()
circle(50, 360)
end_fill()
penup()
goto(160, 110)
pendown()
pensize(5)
color("white")
begin_fill()
circle(20, 360)
end_fill()
penup()
goto(-270, -130)
pendown()
color("red")
begin_fill()
circle(75, 360)
end_fill()
penup()
goto(270, -130)
pendown()
color("red")
begin_fill()
circle(75, 360)
end_fill()
penup()
color("black")
begin_fill()
pensize()
goto(0, 30)
seth(30)
pendown()
fd(30)
penup()
seth(120)
pendown()
circle(30, 120)
penup()
seth(150)
pendown()
color("black")
fd(-30)
end_fill()
penup()
goto(0, 5)
seth(190)
pensize(3)
pendown()
fd(130)
seth(150)
circle(-30, 50)
penup()
goto(0, 5)
seth(-10)
pensize(3)
pendown()
fd(130)
seth(30)
circle(30, 50)
penup()
goto(-100, -15)
seth(290)
pendown()
fd(180)
penup()from turtle import*
import time
# 设置抬笔跳跃
def my_goto(x, y):
penup()
goto(x, y)
pendown()
# 绘制项圈
def collar():
color("red")
pencolor("black")
begin_fill()
my_goto(-100, 0)
lt(10)
circle(-800, 20)
rt(70)
fd(10)
goto(-100, -10)
goto(-100, 0)
end_fill()
# 绘制大脸
def face():
color("sky blue")
pencolor("black")
begin_fill()
lt(46)
circle(251,-293)
lt(10)
circle(200,273)
end_fill()
# 绘制眼睛
def eyes():
# 绘制左眼
my_goto(-45,338)
color("white")
begin_fill()
pencolor("black")
tracer(False)
a = 3
rt(45)
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a -= 0.05
lt(3)
fd(a)
else:
a += 0.05
lt(3)
fd(a)
tracer(True)
end_fill()
# 绘制左眼球
color("black")
begin_fill()
pencolor("black")
my_goto(-5, 320)
circle(15)
end_fill()
color("white")
begin_fill()
my_goto(10, 318)
circle(5)
end_fill()
# 绘制右眼
my_goto(45,338)
color("white")
begin_fill()
pencolor("black")
tracer(False)
a = 3
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a -= 0.05
lt(3)
fd(a)
else:
a += 0.05
lt(3)
fd(a)
tracer(True)
end_fill()
# 绘制右黑眼球
color("black")
begin_fill()
pencolor("black")
my_goto(50,320)
circle(15)
end_fill()
color("white")
begin_fill()
my_goto(54, 318)
circle(5)
end_fill()
# 绘制鼻子
def nose():
pensize(3)
color("red")
begin_fill()
pencolor("black")
my_goto(4,272)
circle(35)
end_fill()
# 绘制鼻尖
color("white")
begin_fill()
my_goto(33, 290)
circle(5)
end_fill()
# 绘制嘴巴
def mouse():
pencolor("black")
my_goto(38,202)
goto(38,50)
my_goto(-110,160)
lt(15)
circle(150,150)
# 绘制胡子
def beard():
pencolor("black")
pensize(4)
# 绘制左边的胡子
my_goto(-120,200)
goto(-20,180)
my_goto(-120, 170)
goto(-20,160)
my_goto(-120, 130)
goto(-20,140)
# 绘制右边的胡子
my_goto(196,200)
goto(96,180)
my_goto(196, 170)
goto(96,160)
my_goto(196, 130)
goto(96,140)
# 绘制猫身
def body():
color("sky blue")
begin_fill()
pencolor("black")
# 左半边的身子
my_goto(-100, -10)
rt(35)
fd(-180)
circle(-50,-180)
fd(-80)
lt(50)
fd(-60)
fd(190)
rt(30)
fd(60)
lt(115)
fd(80)
lt(10)
fd(65)
#机器猫的裤裆
lt(90)
circle(-35,190)
lt(90)
fd(65)
rt(-10)
fd(80)
# 右半边的身子
lt(115)
fd(60)
rt(35)
fd(190)
fd(-60)
rt(60)
fd(180)
circle(50,180)
goto(185,-10)
goto(-100, -10)
end_fill()
# 绘制猫肚子
def belly():
color("white")
pencolor("black")
begin_fill()
my_goto(-80,-10)
seth(0)
lt(80)
circle(-120, -200)
end_fill()
my_goto(-10,-70)
seth(0)
lt(80)
circle(-50, -200)
goto(-10,-70)
# 绘制铃铛
def bell():
my_goto(38,-10)
seth(180)
color("yellow")
begin_fill()
pencolor("black")
circle(20)
end_fill()
# 绘制双手
def hand():
# 绘制左手
color("white")
begin_fill()
pencolor("black")
my_goto(-230,-125)
circle(60)
end_fill()
# 绘制右手
color("white")
begin_fill()
pencolor("black")
my_goto(380, 50)
circle(60)
end_fill()
# 绘制双脚
def foot():
# 绘制左脚
color("white")
begin_fill()
pencolor("black")
my_goto(-10, -330)
seth(0)
fd(10)
circle(-35, 180)
fd(140)
circle(-35, 180)
# fd(10)
goto(-10,-330)
end_fill()
# 绘制右脚
color("white")
begin_fill()
pencolor("black")
my_goto(220, -330)
seth(0)
fd(10)
circle(-35, 180)
fd(140)
circle(-35, 180)
# fd(10)
goto(220,-330)
end_fill()
# 署名及日期落款
def auther_name():
my_goto(380, 150)
write('Go! GO! ---2021/12/26', font=("Bradley Hand ITC", 18, "bold"))
# 调用函数
def main():
hideturtle()
speed(2)
pensize(3)
collar()
face()
eyes()
nose()
mouse()
beard()
body()
belly()
bell()
hand()
foot()
auther_name()
exitonclick()
if __name__ == '__main__':
main()
time.sleep(20) #停止20s
goto(100, -15)
seth(-110)
pendown()
fd(180)
circle(-40, 140)
time.sleep(20) #停20秒
from turtle import*
import time
# 设置抬笔跳跃
def my_goto(x, y):
penup()
goto(x, y)
pendown()
# 绘制项圈
def collar():
color("red")
pencolor("black")
begin_fill()
my_goto(-100, 0)
lt(10)
circle(-800, 20)
rt(70)
fd(10)
goto(-100, -10)
goto(-100, 0)
end_fill()
# 绘制大脸
def face():
color("sky blue")
pencolor("black")
begin_fill()
lt(46)
circle(251,-293)
lt(10)
circle(200,273)
end_fill()
# 绘制眼睛
def eyes():
# 绘制左眼
my_goto(-45,338)
color("white")
begin_fill()
pencolor("black")
tracer(False)
a = 3
rt(45)
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a -= 0.05
lt(3)
fd(a)
else:
a += 0.05
lt(3)
fd(a)
tracer(True)
end_fill()
# 绘制左眼球
color("black")
begin_fill()
pencolor("black")
my_goto(-5, 320)
circle(15)
end_fill()
color("white")
begin_fill()
my_goto(10, 318)
circle(5)
end_fill()
# 绘制右眼
my_goto(45,338)
color("white")
begin_fill()
pencolor("black")
tracer(False)
a = 3
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a -= 0.05
lt(3)
fd(a)
else:
a += 0.05
lt(3)
fd(a)
tracer(True)
end_fill()
# 绘制右黑眼球
color("black")
begin_fill()
pencolor("black")
my_goto(50,320)
circle(15)
end_fill()
color("white")
begin_fill()
my_goto(54, 318)
circle(5)
end_fill()
# 绘制鼻子
def nose():
pensize(3)
color("red")
begin_fill()
pencolor("black")
my_goto(4,272)
circle(35)
end_fill()
# 绘制鼻尖
color("white")
begin_fill()
my_goto(33, 290)
circle(5)
end_fill()
# 绘制嘴巴
def mouse():
pencolor("black")
my_goto(38,202)
goto(38,50)
my_goto(-110,160)
lt(15)
circle(150,150)
# 绘制胡子
def beard():
pencolor("black")
pensize(4)
# 绘制左边的胡子
my_goto(-120,200)
goto(-20,180)
my_goto(-120, 170)
goto(-20,160)
my_goto(-120, 130)
goto(-20,140)
# 绘制右边的胡子
my_goto(196,200)
goto(96,180)
my_goto(196, 170)
goto(96,160)
my_goto(196, 130)
goto(96,140)
# 绘制猫身
def body():
color("sky blue")
begin_fill()
pencolor("black")
# 左半边的身子
my_goto(-100, -10)
rt(35)
fd(-180)
circle(-50,-180)
fd(-80)
lt(50)
fd(-60)
fd(190)
rt(30)
fd(60)
lt(115)
fd(80)
lt(10)
fd(65)
#机器猫的裤裆
lt(90)
circle(-35,190)
lt(90)
fd(65)
rt(-10)
fd(80)
# 右半边的身子
lt(115)
fd(60)
rt(35)
fd(190)
fd(-60)
rt(60)
fd(180)
circle(50,180)
goto(185,-10)
goto(-100, -10)
end_fill()
# 绘制猫肚子
def belly():
color("white")
pencolor("black")
begin_fill()
my_goto(-80,-10)
seth(0)
lt(80)
circle(-120, -200)
end_fill()
my_goto(-10,-70)
seth(0)
lt(80)
circle(-50, -200)
goto(-10,-70)
# 绘制铃铛
def bell():
my_goto(38,-10)
seth(180)
color("yellow")
begin_fill()
pencolor("black")
circle(20)
end_fill()
# 绘制双手
def hand():
# 绘制左手
color("white")
begin_fill()
pencolor("black")
my_goto(-230,-125)
circle(60)
end_fill()
# 绘制右手
color("white")
begin_fill()
pencolor("black")
my_goto(380, 50)
circle(60)
end_fill()
# 绘制双脚
def foot():
# 绘制左脚
color("white")
begin_fill()
pencolor("black")
my_goto(-10, -330)
seth(0)
fd(10)
circle(-35, 180)
fd(140)
circle(-35, 180)
# fd(10)
goto(-10,-330)
end_fill()
# 绘制右脚
color("white")
begin_fill()
pencolor("black")
my_goto(220, -330)
seth(0)
fd(10)
circle(-35, 180)
fd(140)
circle(-35, 180)
# fd(10)
goto(220,-330)
end_fill()
# 署名及日期落款
def auther_name():
my_goto(380, 150)
write('Go! GO! ---2021/12/26', font=("Bradley Hand ITC", 18, "bold"))
# 调用函数
def main():
hideturtle()
speed(2)
pensize(3)
collar()
face()
eyes()
nose()
mouse()
beard()
body()
belly()
bell()
hand()
foot()
auther_name()
exitonclick()
if __name__ == '__main__':
main()
time.sleep(20) #停止20s
import turtle
import time
t = turtle.Pen()
for i in range(360):
t.forward(i)
t.left(59)
time.sleep(30)
感谢大家,点赞,收藏,关注,评论!