{"id":107,"date":"2025-09-12T04:42:50","date_gmt":"2025-09-11T20:42:50","guid":{"rendered":"http:\/\/www.puter.cn\/?p=107"},"modified":"2025-09-12T04:42:50","modified_gmt":"2025-09-11T20:42:50","slug":"%e3%80%90%e7%bc%96%e7%a8%8b%e6%95%99%e7%a8%8b%e3%80%91turtle-%e6%b5%b7%e9%be%9f%e7%bb%98%e5%9b%be%c2%b6","status":"publish","type":"post","link":"http:\/\/www.puter.cn\/?p=107","title":{"rendered":"\u3010\u7f16\u7a0b\u6559\u7a0b\u3011turtle\u00a0&#8212; \u6d77\u9f9f\u7ed8\u56fe\u00b6"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u6982\u8ff0<a href=\"https:\/\/docs.python.org\/zh-cn\/3\/library\/turtle.html#introduction\"><\/a><\/h2>\n\n\n\n<p>\u6d77\u9f9f\u7ed8\u56fe\u662f\u5bf9&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Turtle_(robot)\">\u6700\u65e9\u5728 Logo \u4e2d\u5f15\u5165\u7684\u53d7\u6b22\u8fce\u7684\u51e0\u4f55\u7ed8\u56fe\u5de5\u5177<\/a>&nbsp;\u7684\u5b9e\u73b0\uff0c\u5b83\u7531 Wally Feurzeig, Seymour Papert \u548c Cynthia Solomon \u5728 1967 \u5e74\u5f00\u53d1\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5165\u95e8<a href=\"https:\/\/docs.python.org\/zh-cn\/3\/library\/turtle.html#get-started\"><\/a><\/h2>\n\n\n\n<p>\u8bf7\u60f3\u8c61\u7ed8\u56fe\u533a\u6709\u4e00\u53ea\u673a\u5668\u6d77\u9f9f\uff0c\u8d77\u59cb\u4f4d\u7f6e\u5728 x-y \u5e73\u9762\u7684 (0, 0) \u70b9\u3002\u5148\u6267\u884c&nbsp;<code>import&nbsp;turtle<\/code>\uff0c\u518d\u6267\u884c&nbsp;<code>turtle.forward(15)<\/code>\uff0c\u5b83\u5c06(\u5728\u5c4f\u5e55\u4e0a)\u671d\u6240\u9762\u5bf9\u7684 x \u8f74\u6b63\u65b9\u5411\u524d\u8fdb 15 \u50cf\u7d20\uff0c\u968f\u7740\u5b83\u7684\u79fb\u52a8\u753b\u51fa\u4e00\u6761\u7ebf\u6bb5\u3002\u518d\u6267\u884c&nbsp;<code>turtle.right(25)<\/code>\uff0c\u5b83\u5c06\u539f\u5730\u53f3\u8f6c 25 \u5ea6\u3002<\/p>\n\n\n\n<p>Turtle star<\/p>\n\n\n\n<p>\u4f7f\u7528\u6d77\u9f9f\u7ed8\u56fe\u53ef\u4ee5\u7f16\u5199\u91cd\u590d\u6267\u884c\u7b80\u5355\u52a8\u4f5c\u7684\u7a0b\u5e8f\u753b\u51fa\u7cbe\u7ec6\u590d\u6742\u7684\u5f62\u72b6\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/docs.python.org\/zh-cn\/3\/_images\/turtle-star.png\" alt=\"..\/_images\/turtle-star.png\"\/><\/figure>\n\n\n\n<p>\u5728 Python \u4e2d\uff0c\u6d77\u9f9f\u7ed8\u56fe\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5b9e\u4f53\u201c\u6d77\u9f9f\u201d\u5f62\u8c61\uff08\u5e26\u6709\u753b\u7b14\u7684\u5c0f\u673a\u5668\u52a8\u7269\uff09\uff0c\u5047\u5b9a\u5b83\u5728\u5730\u677f\u4e0a\u5e73\u94fa\u7684\u7eb8\u5f20\u4e0a\u753b\u7ebf\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u5b66\u4e60\u8005\u6765\u8bf4\u8fd9\u662f\u4e00\u79cd\u63a5\u89e6\u7f16\u7a0b\u6982\u5ff5\u548c\u4e0e\u8f6f\u4ef6\u4ea4\u4e92\u7684\u9ad8\u6548\u4e14\u4e45\u7ecf\u9a8c\u8bc1\u7684\u65b9\u5f0f\uff0c\u56e0\u4e3a\u5b83\u80fd\u63d0\u4f9b\u5373\u65f6\u3001\u53ef\u89c1\u7684\u53cd\u9988\u3002 \u5b83\u8fd8\u80fd\u63d0\u4f9b\u65b9\u4fbf\u76f4\u89c2\u7684\u56fe\u5f62\u8f93\u51fa\u3002<\/p>\n\n\n\n<p>\u6d77\u9f9f\u7ed8\u56fe\u6700\u521d\u662f\u4f5c\u4e3a\u4e00\u79cd\u6559\u5b66\u5de5\u5177\u88ab\u521b\u5efa\u7684\uff0c\u4f9b\u6559\u5e08\u5728\u8bfe\u5802\u4e0a\u4f7f\u7528\u3002 \u5bf9\u4e8e\u9700\u8981\u751f\u6210\u4e00\u4e9b\u56fe\u5f62\u8f93\u51fa\u7684\u7a0b\u5e8f\u5458\u6765\u8bf4\u8fd9\u662f\u4e00\u79cd\u65e0\u9700\u5728\u5de5\u4f5c\u4e2d\u5f15\u5165\u66f4\u9ad8\u590d\u6742\u5ea6\u6216\u5916\u90e8\u5e93\u7684\u65b9\u5f0f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6559\u7a0b<a href=\"https:\/\/docs.python.org\/zh-cn\/3\/library\/turtle.html#tutorial\"><\/a><\/h2>\n\n\n\n<p>\u65b0\u7528\u6237\u5e94\u5f53\u4ece\u8fd9\u91cc\u5f00\u59cb\u3002 \u5728\u672c\u6559\u7a0b\u4e2d\u6211\u4eec\u5c06\u63a2\u7d22\u6d77\u9f9f\u7ed8\u56fe\u7684\u4e00\u4e9b\u57fa\u672c\u77e5\u8bc6\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u542f\u52a8\u6d77\u9f9f\u73af\u5883<a href=\"https:\/\/docs.python.org\/zh-cn\/3\/library\/turtle.html#starting-a-turtle-environment\"><\/a><\/h3>\n\n\n\n<p>\u5728 Python shell \u4e2d\uff0c\u5bfc\u5165&nbsp;<code>turtle<\/code>&nbsp;\u6a21\u5757\u7684\u6240\u6709\u5bf9\u8c61:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>from<\/strong> <strong>turtle<\/strong> <strong>import<\/strong> *\n<\/pre>\n\n\n\n<p>\u5982\u679c\u4f60\u9047\u5230\u4e86&nbsp;<code>No&nbsp;module&nbsp;named&nbsp;'_tkinter'<\/code>&nbsp;\u9519\u8bef\uff0c\u5219\u9700\u8981\u5728\u4f60\u7684\u7cfb\u7edf\u4e2d\u5b89\u88c5&nbsp;<a href=\"https:\/\/docs.python.org\/zh-cn\/3\/library\/tkinter.html#module-tkinter\"><code>Tk&nbsp;\u63a5\u53e3\u5305<\/code><\/a>\u3002<\/p>\n\n\n\n<p>\u5b98\u65b9\u94fe\u63a5\uff1a<a href=\"https:\/\/docs.python.org\/zh-cn\/3\/library\/turtle.html\">turtle &#8212; \u6d77\u9f9f\u7ed8\u56fe \u2014 Python 3.13.7 \u6587\u6863<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8ff0 \u6d77\u9f9f\u7ed8\u56fe\u662f\u5bf9&nbsp;\u6700\u65e9\u5728 Logo \u4e2d\u5f15\u5165\u7684\u53d7\u6b22\u8fce\u7684\u51e0\u4f55\u7ed8\u56fe\u5de5\u5177&nbsp;\u7684\u5b9e\u73b0\uff0c\u5b83\u7531 Wall [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-107","post","type-post","status-publish","format-standard","hentry","category-professional"],"_links":{"self":[{"href":"http:\/\/www.puter.cn\/index.php?rest_route=\/wp\/v2\/posts\/107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.puter.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.puter.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.puter.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.puter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=107"}],"version-history":[{"count":1,"href":"http:\/\/www.puter.cn\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions"}],"predecessor-version":[{"id":108,"href":"http:\/\/www.puter.cn\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions\/108"}],"wp:attachment":[{"href":"http:\/\/www.puter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.puter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.puter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}