用HTML做2个新年代码 您所在的位置:网站首页 新年祝福语超长可复制 用HTML做2个新年代码

用HTML做2个新年代码

2024-06-03 11:55| 来源: 网络整理| 查看: 265

Python画皮卡丘

2301_76705824: 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



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有