{"id":332,"date":"2026-02-03T19:32:58","date_gmt":"2026-02-03T11:32:58","guid":{"rendered":"http:\/\/lhy.cpolar.top\/?p=332"},"modified":"2026-02-03T19:32:58","modified_gmt":"2026-02-03T11:32:58","slug":"turtle%e5%ba%93-%e6%a1%88%e4%be%8b9%ef%bc%9a%e7%94%bb%e7%9a%ae%e5%8d%a1%e4%b8%98","status":"publish","type":"post","link":"http:\/\/lhy.cpolar.top\/?p=332","title":{"rendered":"turtle\u5e93\u2014\u2014\u6848\u4f8b9\uff1a\u753b\u76ae\u5361\u4e18"},"content":{"rendered":"\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/lhy.cpolar.top\/wp-content\/uploads\/2026\/02\/%E7%94%BB%E7%9A%AE%E5%8D%A1%E4%B8%98.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/lhy.cpolar.top\/wp-content\/uploads\/2026\/02\/%E7%94%BB%E7%9A%AE%E5%8D%A1%E4%B8%98.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\u5f53\u524d\u56fe\u7247\u6ca1\u6709\u66ff\u4ee3\u6587\u5b57\u3002\u6587\u4ef6\u540d\u4e3a\uff1a%e7%94%bb%e7%9a%ae%e5%8d%a1%e4%b8%98\" \/><\/div><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>import turtle\ndef getPosition(x, y):\n        turtle.setx(x)\n        turtle.sety(y)\n        print(x, y)\nclass Pikachu:\n    def __init__(self):\n        self.t = turtle.Turtle()\n        t = self.t\n        t.pensize(3)\n        t.speed(9)\n        t.ondrag(getPosition)\n\n    def noTrace_goto(self, x, y):\n        self.t.penup()\n        self.t.goto(x, y)\n        self.t.pendown()\n    def leftEye(self, x, y):\n        self.noTrace_goto(x, y)\n        t = self.t\n        t.seth(0)\n        t.fillcolor('#333333')\n        t.begin_fill()\n        t.circle(22)\n        t.end_fill()\n        self.noTrace_goto(x, y+10)\n        t.fillcolor('#000000')\n        t.begin_fill()\n        t.circle(10)\n        t.end_fill()\n        self.noTrace_goto(x+6, y + 22)\n        t.fillcolor('#ffffff')\n        t.begin_fill()\n        t.circle(10)\n        t.end_fill()\n    def rightEye(self, x, y):\n        self.noTrace_goto(x, y)\n        t = self.t\n        t.seth(0)\n        t.fillcolor('#333333')\n        t.begin_fill()\n        t.circle(22)\n        t.end_fill()\n        self.noTrace_goto(x, y+10)\n        t.fillcolor('#000000')\n        t.begin_fill()\n        t.circle(10)\n        t.end_fill()\n        self.noTrace_goto(x-6, y + 22)\n        t.fillcolor('#ffffff')\n        t.begin_fill()\n        t.circle(10)\n        t.end_fill()\n    def mouth(self, x, y):\n        self.noTrace_goto(x, y)\n        t = self.t\n        t.fillcolor('#88141D')\n        t.begin_fill()\n        # \u4e0b\u5634\u5507\n        l1 = &#091;]\n        l2 = &#091;]\n        t.seth(190)\n        a = 0.7\n        for i in range(28):\n            a += 0.1\n            t.right(3)\n            t.fd(a)\n            l1.append(t.position())\n\n        self.noTrace_goto(x, y)\n\n        t.seth(10)\n        a = 0.7\n        for i in range(28):\n            a += 0.1\n            t.left(3)\n            t.fd(a)\n            l2.append(t.position())\n\n        # \u4e0a\u5634\u5507\n\n        t.seth(10)\n        t.circle(50, 15)\n        t.left(180)\n        t.circle(-50, 15)\n\n        t.circle(-50, 40)\n        t.seth(233)\n        t.circle(-50, 55)\n        t.left(180)\n        t.circle(50, 12.1)\n        t.end_fill()\n        # \u820c\u5934\n        self.noTrace_goto(17, 54)\n        t.fillcolor('#DD716F')\n        t.begin_fill()\n        t.seth(145)\n        t.circle(40, 86)\n        t.penup()\n        for pos in reversed(l1&#091;:20]):\n            t.goto(pos&#091;0], pos&#091;1]+1.5)\n        for pos in l2&#091;:20]:\n            t.goto(pos&#091;0], pos&#091;1]+1.5)\n        t.pendown()\n        t.end_fill()\n        # \u9f3b\u5b50\n        self.noTrace_goto(-17, 94)\n        t.seth(8)\n        t.fd(4)\n        t.back(8)\n    # \u7ea2\u8138\u988a\n    def leftCheek(self, x, y):\n        turtle.tracer(False)\n        t = self.t\n        self.noTrace_goto(x, y)\n        t.seth(300)\n        t.fillcolor('#DD4D28')\n        t.begin_fill()\n        a = 2.3\n        for i in range(120):\n            if 0 &lt;= i &lt; 30 or 60 &lt;= i &lt; 90:\n                a -= 0.05\n                t.lt(3)\n                t.fd(a)\n            else:\n                a += 0.05\n                t.lt(3)\n                t.fd(a)\n        t.end_fill()\n        turtle.tracer(True)\n    def rightCheek(self, x, y):\n        t = self.t\n        turtle.tracer(False)\n        self.noTrace_goto(x, y)\n        t.seth(60)\n        t.fillcolor('#DD4D28')\n        t.begin_fill()\n        a = 2.3\n        for i in range(120):\n            if 0 &lt;= i &lt; 30 or 60 &lt;= i &lt; 90:\n                a -= 0.05\n                t.lt(3)\n                t.fd(a)\n            else:\n                a += 0.05\n                t.lt(3)\n                t.fd(a)\n        t.end_fill()\n        turtle.tracer(True)\n    def colorLeftEar(self, x, y):\n        t = self.t\n        self.noTrace_goto(x, y)\n        t.fillcolor('#000000')\n        t.begin_fill()\n        t.seth(330)\n        t.circle(100, 35)\n        t.seth(219)\n        t.circle(-300, 19)\n        t.seth(110)\n        t.circle(-30, 50)\n        t.circle(-300, 10)\n        t.end_fill()\n\n    def colorRightEar(self, x, y):\n        t = self.t\n        self.noTrace_goto(x, y)\n        t.fillcolor('#000000')\n        t.begin_fill()\n        t.seth(300)\n        t.circle(-100, 30)\n        t.seth(35)\n        t.circle(300, 15)\n        t.circle(30, 50)\n        t.seth(190)\n        t.circle(300, 17)\n        t.end_fill()\n\n    def body(self):\n        t = self.t\n        t.fillcolor('#F6D02F')\n        t.begin_fill()\n        # \u53f3\u8138\u8f6e\u5ed3\n        t.penup()\n        t.circle(130, 40)\n        t.pendown()\n        t.circle(100, 105)\n        t.left(180)\n        t.circle(-100, 5)\n        # \u53f3\u8033\u6735\n        t.seth(20)\n        t.circle(300, 30)\n        t.circle(30, 50)\n        t.seth(190)\n        t.circle(300, 36)\n        # \u4e0a\u8f6e\u5ed3\n        t.seth(150)\n        t.circle(150, 70)\n\n        # \u5de6\u8033\u6735\n        t.seth(200)\n        t.circle(300, 40)\n        t.circle(30, 50)\n        t.seth(20)\n        t.circle(300, 35)\n        #print(t.pos())\n        # \u5de6\u8138\u8f6e\u5ed3\n        t.seth(240)\n        t.circle(105, 95)\n        t.left(180)\n        t.circle(-105, 5)\n        # \u5de6\u624b\n        t.seth(210)\n        t.circle(500, 18)\n        t.seth(200)\n        t.fd(10)\n        t.seth(280)\n        t.fd(7)\n        t.seth(210)\n        t.fd(10)\n        t.seth(300)\n        t.circle(10, 80)\n        t.seth(220)\n        t.fd(10)\n        t.seth(300)\n        t.circle(10, 80)\n        t.seth(240)\n        t.fd(12)\n        t.seth(0)\n        t.fd(13)\n        t.seth(240)\n        t.circle(10, 70)\n        t.seth(10)\n        t.circle(10, 70)\n        t.seth(10)\n        t.circle(300, 18)\n        t.seth(75)\n        t.circle(500, 8)\n        t.left(180)\n        t.circle(-500, 15)\n        t.seth(250)\n        t.circle(100, 65)\n        # \u5de6\u811a\n        t.seth(320)\n        t.circle(100, 5)\n        t.left(180)\n        t.circle(-100, 5)\n        t.seth(220)\n        t.circle(200, 20)\n        t.circle(20, 70)\n        t.seth(60)\n        t.circle(-100, 20)\n        t.left(180)\n        t.circle(100, 20)\n        t.seth(300)\n        t.circle(10, 70)\n        t.seth(60)\n        t.circle(-100, 20)\n        t.left(180)\n        t.circle(100, 20)\n        t.seth(10)\n        t.circle(100, 60)\n        # \u6a2a\u5411\n        t.seth(180)\n        t.circle(-100, 10)\n        t.left(180)\n        t.circle(100, 10)\n        t.seth(5)\n        t.circle(100, 10)\n        t.circle(-100, 40)\n        t.circle(100, 35)\n        t.left(180)\n        t.circle(-100, 10)\n        # \u53f3\u811a\n        t.seth(290)\n        t.circle(100, 55)\n        t.circle(10, 50)\n        t.seth(120)\n        t.circle(100, 20)\n        t.left(180)\n        t.circle(-100, 20)\n        t.seth(0)\n        t.circle(10, 50)\n        t.seth(110)\n        t.circle(100, 20)\n        t.left(180)\n        t.circle(-100, 20)\n        t.seth(30)\n        t.circle(20, 50)\n        t.seth(100)\n        t.circle(100, 40)\n        # \u53f3\u4fa7\u8eab\u4f53\u8f6e\u5ed3\n        t.seth(200)\n        t.circle(-100, 5)\n        t.left(180)\n        t.circle(100, 5)\n        t.left(30)\n        t.circle(100, 75)\n        t.right(15)\n        t.circle(-300, 21)\n        t.left(180)\n        t.circle(300, 3)\n        # \u53f3\u624b\n        t.seth(43)\n        t.circle(200, 60)\n\n        t.right(10)\n        t.fd(10)\n        t.circle(5, 160)\n        t.seth(90)\n        t.circle(5, 160)\n        t.seth(90)\n\n        t.fd(10)\n        t.seth(90)\n        t.circle(5, 180)\n        t.fd(10)\n        t.left(180)\n        t.left(20)\n        t.fd(10)\n        t.circle(5, 170)\n        t.fd(10)\n        t.seth(240)\n        t.circle(50, 30)\n\n        t.end_fill()\n        self.noTrace_goto(130, 125)\n        t.seth(-20)\n        t.fd(5)\n        t.circle(-5, 160)\n        t.fd(5)\n        # \u624b\u6307\u7eb9\n        self.noTrace_goto(166, 130)\n        t.seth(-90)\n        t.fd(3)\n        t.circle(-4, 180)\n        t.fd(3)\n        t.seth(-90)\n        t.fd(3)\n        t.circle(-4, 180)\n        t.fd(3)\n        # \u5c3e\u5df4\n        self.noTrace_goto(168, 134)\n        t.fillcolor('#F6D02F')\n        t.begin_fill()\n        t.seth(40)\n        t.fd(200)\n        t.seth(-80)\n        t.fd(150)\n        t.seth(210)\n        t.fd(150)\n        t.left(90)\n        t.fd(100)\n        t.right(95)\n        t.fd(100)\n        t.left(110)\n        t.fd(70)\n        t.right(110)\n        t.fd(80)\n        t.left(110)\n        t.fd(30)\n        t.right(110)\n        t.fd(32)\n        t.right(106)\n        t.circle(100, 25)\n        t.right(15)\n        t.circle(-300, 2)\n        ##############\n        #print(t.pos())\n        t.seth(30)\n        t.fd(40)\n        t.left(100)\n        t.fd(70)\n        t.right(100)\n        t.fd(80)\n        t.left(100)\n        t.fd(46)\n        t.seth(66)\n        t.circle(200, 38)\n        t.right(10)\n        t.fd(10)\n        t.end_fill()\n        # \u5c3e\u5df4\u82b1\u7eb9 \n        t.fillcolor('#923E24')\n        self.noTrace_goto(126.82, -156.84)\n        t.begin_fill()\n\n        t.seth(30)\n        t.fd(40)\n        t.left(100)\n        t.fd(40)\n        t.pencolor('#923e24')\n        t.seth(-30)\n        t.fd(30)\n        t.left(140)\n        t.fd(20)\n        t.right(150)\n        t.fd(20)\n        t.left(150)\n        t.fd(20)\n        t.right(150)\n        t.fd(20)\n        t.left(130)\n        t.fd(18)\n        t.pencolor('#000000')\n        t.seth(-45)\n        t.fd(67)\n        t.right(110)\n        t.fd(80)\n        t.left(110)\n        t.fd(30)\n        t.right(110)\n        t.fd(32)\n        t.right(106)\n        t.circle(100, 25)\n        t.right(15)\n        t.circle(-300, 2)\n        t.end_fill()\n\n        # \u5e3d\u5b50\u3001\u773c\u775b\u3001\u5634\u5df4\u3001\u8138\u988a\n        self.cap(-134.07, 147.81)\n        self.mouth(-5, 25)\n        self.leftCheek(-126, 32)\n        self.rightCheek(107, 63)\n        self.colorLeftEar(-250, 100)\n        self.colorRightEar(140, 270)\n        self.leftEye(-85, 90)\n        self.rightEye(50, 110)\n        t.hideturtle()\n\n    def cap(self, x, y):\n        self.noTrace_goto(x, y)\n        t = self.t\n        t.fillcolor('#CD0000')\n        t.begin_fill()\n        t.seth(200)\n        t.circle(400, 7)\n        t.left(180)\n        t.circle(-400, 30)\n        t.circle(30, 60)\n        t.fd(50)\n        t.circle(30, 45)\n        t.fd(60)\n        t.left(5)\n        t.circle(30, 70)\n        t.right(20)\n        t.circle(200, 70)\n        t.circle(30, 60)\n        t.fd(70)\n        # print(t.pos())\n        t.right(35)\n        t.fd(50)\n        t.circle(8, 100)\n        t.end_fill()\n        self.noTrace_goto(-168.47, 185.52)\n        t.seth(36)\n        t.circle(-270, 54)\n        t.left(180)\n        t.circle(270, 27)\n        t.circle(-80, 98)\n        t.fillcolor('#444444')\n        t.begin_fill()\n        t.left(180)\n        t.circle(80, 197)\n        t.left(58)\n        t.circle(200, 45)\n        t.end_fill()\n        self.noTrace_goto(-58, 270)\n        t.pencolor('#228B22')\n        t.dot(35)\n        self.noTrace_goto(-30, 280)\n        t.fillcolor('#228B22')\n        t.begin_fill()\n        t.seth(100)\n        t.circle(30, 180)\n        t.seth(190)\n        t.fd(15)\n        t.seth(100)\n        t.circle(-45, 180)\n        t.right(90)\n        t.fd(15)\n        t.end_fill()\n        t.pencolor('#000000')\n    def start(self):\n        self.body()\ndef main():\n    print('Painting the Pikachu... ')\n    turtle.screensize(800, 600)\n    turtle.title('Pikachu')\n    pikachu = Pikachu()\n    pikachu.start()\n    turtle.mainloop()\n\nif __name__ == '__main__':\n    main()\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":7,"featured_media":333,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[8,19,20],"class_list":["post-332","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tyjs","tag-python","tag-turtle","tag-20"],"_links":{"self":[{"href":"http:\/\/lhy.cpolar.top\/index.php?rest_route=\/wp\/v2\/posts\/332","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/lhy.cpolar.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/lhy.cpolar.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/lhy.cpolar.top\/index.php?rest_route=\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"http:\/\/lhy.cpolar.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=332"}],"version-history":[{"count":1,"href":"http:\/\/lhy.cpolar.top\/index.php?rest_route=\/wp\/v2\/posts\/332\/revisions"}],"predecessor-version":[{"id":334,"href":"http:\/\/lhy.cpolar.top\/index.php?rest_route=\/wp\/v2\/posts\/332\/revisions\/334"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/lhy.cpolar.top\/index.php?rest_route=\/wp\/v2\/media\/333"}],"wp:attachment":[{"href":"http:\/\/lhy.cpolar.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/lhy.cpolar.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=332"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/lhy.cpolar.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}