{"id":954977,"date":"2024-12-27T02:07:16","date_gmt":"2024-12-26T18:07:16","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/954977.html"},"modified":"2024-12-27T02:07:18","modified_gmt":"2024-12-26T18:07:18","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e7%bc%96%e7%a8%8b%e7%94%bb%e5%9c%86","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/954977.html","title":{"rendered":"\u5982\u4f55\u7528python\u7f16\u7a0b\u753b\u5706"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25095031\/96eb7596-ee5a-44b7-b0e0-bbd19d7a80e1.webp\" alt=\"\u5982\u4f55\u7528python\u7f16\u7a0b\u753b\u5706\" \/><\/p>\n<p><p> <strong>\u4f7f\u7528Python\u7f16\u7a0b\u753b\u5706\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528matplotlib\u5e93\u3001turtle\u6a21\u5757\u548cpygame\u5e93\u7b49\u3002\u63a8\u8350\u4f7f\u7528matplotlib\u5e93\uff0c\u5b83\u529f\u80fd\u5f3a\u5927\u3001\u6613\u4e8e\u4f7f\u7528\uff0c\u5e76\u4e14\u53ef\u4ee5\u751f\u6210\u9ad8\u8d28\u91cf\u7684\u56fe\u5f62\u3002<\/strong><\/p>\n<\/p>\n<p><p><strong>matplotlib\u5e93<\/strong>\uff1a\u5b83\u662fPython\u4e2d\u6700\u6d41\u884c\u7684\u6570\u636e\u53ef\u89c6\u5316\u5e93\u4e4b\u4e00\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ed8\u5236\u5706\u5f62\u3002\u901a\u8fc7\u521b\u5efa\u4e00\u4e2a\u5706\u5f62\u8865\u4e01\u5e76\u5c06\u5176\u6dfb\u52a0\u5230\u7ed8\u56fe\u4e2d\uff0c\u53ef\u4ee5\u8f7b\u677e\u753b\u51fa\u5706\u3002<\/p>\n<\/p>\n<p><p>\u5728\u5c55\u5f00\u8be6\u7ec6\u63cf\u8ff0\u4e4b\u524d\uff0c\u6211\u4eec\u5148\u7b80\u5355\u4ecb\u7ecdmatplotlib\u5e93\u7684\u4f7f\u7528\u3002matplotlib\u662f\u4e00\u79cd\u4e8c\u7ef4\u7ed8\u56fe\u5e93\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u751f\u6210\u5404\u79cd\u7c7b\u578b\u7684\u56fe\u5f62\uff0c\u5982\u6298\u7ebf\u56fe\u3001\u67f1\u72b6\u56fe\u3001\u6563\u70b9\u56fe\u7b49\uff0c\u5f53\u7136\u4e5f\u5305\u62ec\u5706\u5f62\u3002\u5b83\u7684\u6838\u5fc3\u662fpyplot\u6a21\u5757\uff0c\u63d0\u4f9b\u4e86\u7c7b\u4f3c\u4e8eMATLAB\u7684\u547d\u4ee4\u63a5\u53e3\u3002<\/p>\n<\/p>\n<hr>\n<h2><strong>\u4e00\u3001\u4f7f\u7528MATPLOTLIB\u5e93\u7ed8\u5236\u5706\u5f62<\/strong><\/h2>\n<p><p>Matplotlib\u5e93\u662fPython\u4e2d\u975e\u5e38\u6d41\u884c\u7684\u7ed8\u56fe\u5e93\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u56fe\u5f62\u7ed8\u5236\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h2>1. \u5b89\u88c5\u548c\u5bfc\u5165\u5e93<\/h2>\n<\/p>\n<p><p>\u5728\u4f7f\u7528matplotlib\u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86\u8be5\u5e93\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install matplotlib<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u5bfc\u5165\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import numpy as np<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2. \u521b\u5efa\u57fa\u672c\u5706\u5f62<\/h2>\n<\/p>\n<p><p>\u8981\u753b\u4e00\u4e2a\u5706\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528matplotlib\u7684<code>patches<\/code>\u6a21\u5757\u4e2d\u7684<code>Circle<\/code>\u7c7b\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import numpy as np<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u7ed8\u56fe\u5bf9\u8c61<\/strong><\/h2>\n<p>fig, ax = plt.subplots()<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u5706\u5f62\u5bf9\u8c61\uff0c\u53c2\u6570\u4e3a\u5706\u5fc3\u5750\u6807\u548c\u534a\u5f84<\/strong><\/h2>\n<p>circle = plt.Circle((0.5, 0.5), 0.2, color=&#39;blue&#39;, fill=False)<\/p>\n<h2><strong>\u5c06\u5706\u5f62\u6dfb\u52a0\u5230\u7ed8\u56fe\u4e2d<\/strong><\/h2>\n<p>ax.add_patch(circle)<\/p>\n<h2><strong>\u8bbe\u7f6e\u7ed8\u56fe\u7684\u8303\u56f4<\/strong><\/h2>\n<p>ax.set_xlim(0, 1)<\/p>\n<p>ax.set_ylim(0, 1)<\/p>\n<h2><strong>\u663e\u793a\u7ed8\u56fe<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u5706\u5fc3\u5750\u6807\u4e3a(0.5, 0.5)\uff0c\u534a\u5f84\u4e3a0.2\u7684\u5706\u5f62\uff0c\u5e76\u5c06\u5176\u6dfb\u52a0\u5230\u7ed8\u56fe\u4e2d\u3002<\/p>\n<\/p>\n<p><h2>3. \u81ea\u5b9a\u4e49\u5706\u5f62<\/h2>\n<\/p>\n<p><p>\u9664\u4e86\u57fa\u672c\u7684\u5706\u5f62\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u81ea\u5b9a\u4e49\u5706\u5f62\u7684\u6837\u5f0f\uff0c\u4f8b\u5982\u586b\u5145\u989c\u8272\u3001\u8fb9\u6846\u989c\u8272\u548c\u7ebf\u6761\u6837\u5f0f\u7b49\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u521b\u5efa\u4e00\u4e2a\u586b\u5145\u7684\u7ea2\u8272\u5706\u5f62\uff0c\u5e76\u8bbe\u7f6e\u8fb9\u6846\u989c\u8272\u4e3a\u9ed1\u8272\uff0c\u7ebf\u6761\u6837\u5f0f\u4e3a\u865a\u7ebf<\/p>\n<p>circle = plt.Circle((0.5, 0.5), 0.2, color=&#39;red&#39;, fill=True, edgecolor=&#39;black&#39;, linestyle=&#39;--&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u521b\u5efa\u5177\u6709\u4e0d\u540c\u6837\u5f0f\u7684\u5706\u5f62\u3002<\/p>\n<\/p>\n<h2><strong>\u4e8c\u3001\u4f7f\u7528TURTLE\u6a21\u5757\u7ed8\u5236\u5706\u5f62<\/strong><\/h2>\n<p><p>Turtle\u662fPython\u4e2d\u4e00\u4e2a\u7b80\u5355\u7684\u7ed8\u56fe\u6a21\u5757\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u901a\u8fc7\u4e00\u53ea\u201c\u6d77\u9f9f\u201d\u5728\u5c4f\u5e55\u4e0a\u7ed8\u5236\u5404\u79cd\u5f62\u72b6\u3002<\/p>\n<\/p>\n<p><h2>1. \u7b80\u4ecb\u548c\u5b89\u88c5<\/h2>\n<\/p>\n<p><p>Turtle\u6a21\u5757\u662fPython\u7684\u6807\u51c6\u5e93\u4e4b\u4e00\uff0c\u56e0\u6b64\u4e0d\u9700\u8981\u5355\u72ec\u5b89\u88c5\u3002\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u5bfc\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import turtle<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2. \u57fa\u672c\u7528\u6cd5<\/h2>\n<\/p>\n<p><p>Turtle\u6a21\u5757\u63d0\u4f9b\u4e86\u4e00\u4e2a<code>circle<\/code>\u65b9\u6cd5\uff0c\u53ef\u4ee5\u7528\u6765\u7ed8\u5236\u5706\u5f62\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import turtle<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u6d77\u9f9f\u5bf9\u8c61<\/strong><\/h2>\n<p>t = turtle.Turtle()<\/p>\n<h2><strong>\u7ed8\u5236\u4e00\u4e2a\u534a\u5f84\u4e3a100\u7684\u5706\u5f62<\/strong><\/h2>\n<p>t.circle(100)<\/p>\n<h2><strong>\u5b8c\u6210\u7ed8\u5236<\/strong><\/h2>\n<p>turtle.done()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u6d77\u9f9f\u5bf9\u8c61\uff0c\u5e76\u8ba9\u5b83\u7ed8\u5236\u4e00\u4e2a\u534a\u5f84\u4e3a100\u7684\u5706\u5f62\u3002<\/p>\n<\/p>\n<p><h2>3. \u81ea\u5b9a\u4e49\u5706\u5f62<\/h2>\n<\/p>\n<p><p>Turtle\u6a21\u5757\u8fd8\u5141\u8bb8\u6211\u4eec\u81ea\u5b9a\u4e49\u5706\u5f62\u7684\u989c\u8272\u548c\u7ebf\u6761\u7c97\u7ec6\u7b49\u5c5e\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8bbe\u7f6e\u7ebf\u6761\u989c\u8272\u4e3a\u84dd\u8272\uff0c\u7ebf\u6761\u7c97\u7ec6\u4e3a3<\/p>\n<p>t.pencolor(&quot;blue&quot;)<\/p>\n<p>t.pensize(3)<\/p>\n<h2><strong>\u7ed8\u5236\u4e00\u4e2a\u534a\u5f84\u4e3a100\u7684\u5706\u5f62<\/strong><\/h2>\n<p>t.circle(100)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u6211\u4eec\u53ef\u4ee5\u521b\u5efa\u66f4\u591a\u6837\u5316\u7684\u5706\u5f62\u3002<\/p>\n<\/p>\n<h2><strong>\u4e09\u3001\u4f7f\u7528PYGAME\u5e93\u7ed8\u5236\u5706\u5f62<\/strong><\/h2>\n<p><p>Pygame\u662f\u4e00\u4e2a\u8de8\u5e73\u53f0\u7684Python\u6a21\u5757\uff0c\u7528\u4e8e\u7f16\u5199\u89c6\u9891\u6e38\u620f\u3002\u5b83\u5305\u62ec\u8ba1\u7b97\u673a\u56fe\u5f62\u548c\u58f0\u97f3\u5e93\uff0c\u9002\u5408\u4e8e\u5b9e\u65f6\u56fe\u5f62\u5e94\u7528\u3002<\/p>\n<\/p>\n<p><h2>1. \u5b89\u88c5\u548c\u5bfc\u5165\u5e93<\/h2>\n<\/p>\n<p><p>Pygame\u4e0d\u662fPython\u7684\u6807\u51c6\u5e93\uff0c\u56e0\u6b64\u9700\u8981\u5355\u72ec\u5b89\u88c5\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pygame<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u5bfc\u5165\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pygame<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2. \u521d\u59cb\u5316\u548c\u521b\u5efa\u7a97\u53e3<\/h2>\n<\/p>\n<p><p>\u5728\u4f7f\u7528Pygame\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u521d\u59cb\u5316\u5e76\u521b\u5efa\u4e00\u4e2a\u7a97\u53e3\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pygame<\/p>\n<h2><strong>\u521d\u59cb\u5316Pygame<\/strong><\/h2>\n<p>pygame.init()<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u7a97\u53e3\uff0c\u5927\u5c0f\u4e3a800x600<\/strong><\/h2>\n<p>screen = pygame.display.set_mode((800, 600))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>3. \u7ed8\u5236\u5706\u5f62<\/h2>\n<\/p>\n<p><p>Pygame\u63d0\u4f9b\u4e86<code>draw<\/code>\u6a21\u5757\uff0c\u53ef\u4ee5\u7528\u6765\u7ed8\u5236\u57fa\u672c\u7684\u5f62\u72b6\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7ed8\u5236\u5706\u5f62\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8bbe\u7f6e\u989c\u8272<\/p>\n<p>white = (255, 255, 255)<\/p>\n<p>blue = (0, 0, 255)<\/p>\n<h2><strong>\u586b\u5145\u80cc\u666f\u8272<\/strong><\/h2>\n<p>screen.fill(white)<\/p>\n<h2><strong>\u7ed8\u5236\u4e00\u4e2a\u84dd\u8272\u5706\u5f62\uff0c\u53c2\u6570\u4e3a\u7a97\u53e3\u3001\u989c\u8272\u3001\u5706\u5fc3\u5750\u6807\u548c\u534a\u5f84<\/strong><\/h2>\n<p>pygame.draw.circle(screen, blue, (400, 300), 100)<\/p>\n<h2><strong>\u66f4\u65b0\u663e\u793a<\/strong><\/h2>\n<p>pygame.display.flip()<\/p>\n<h2><strong>\u4fdd\u6301\u7a97\u53e3\u663e\u793a<\/strong><\/h2>\n<p>running = True<\/p>\n<p>while running:<\/p>\n<p>    for event in pygame.event.get():<\/p>\n<p>        if event.type == pygame.QUIT:<\/p>\n<p>            running = False<\/p>\n<h2><strong>\u9000\u51faPygame<\/strong><\/h2>\n<p>pygame.quit()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u7a97\u53e3\uff0c\u5e76\u7ed8\u5236\u4e86\u4e00\u4e2a\u5706\u5fc3\u5750\u6807\u4e3a(400, 300)\uff0c\u534a\u5f84\u4e3a100\u7684\u84dd\u8272\u5706\u5f62\u3002<\/p>\n<\/p>\n<hr>\n<p><p>\u7efc\u4e0a\u6240\u8ff0\uff0c\u4f7f\u7528Python\u7f16\u7a0b\u753b\u5706\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c\u5305\u62ecmatplotlib\u3001turtle\u548cpygame\u7b49\u5e93\u3002\u9009\u62e9\u9002\u5408\u81ea\u5df1\u9700\u6c42\u7684\u5e93\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u8f7b\u677e\u5b9e\u73b0\u5404\u79cd\u5706\u5f62\u7ed8\u5236\u4efb\u52a1\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u7ed8\u5236\u4e0d\u540c\u989c\u8272\u548c\u5927\u5c0f\u7684\u5706\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>matplotlib<\/code>\u5e93\u6765\u7ed8\u5236\u5706\u3002\u901a\u8fc7\u8bbe\u7f6e\u5706\u7684\u534a\u5f84\u548c\u989c\u8272\uff0c\u53ef\u4ee5\u7ed8\u5236\u51fa\u4e0d\u540c\u6837\u5f0f\u7684\u5706\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>Circle<\/code>\u5bf9\u8c61\u53ef\u4ee5\u6307\u5b9a\u5706\u5fc3\u5750\u6807\u3001\u534a\u5f84\u548c\u989c\u8272\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u4ee3\u7801\uff1a  <\/p>\n<pre><code class=\"language-python\">import matplotlib.pyplot as plt\n\nfig, ax = plt.subplots()\ncircle = plt.Circle((0.5, 0.5), 0.3, color=&#39;blue&#39;)\nax.add_artist(circle)\nax.set_xlim(0, 1)\nax.set_ylim(0, 1)\nplt.gca().set_aspect(&#39;equal&#39;)\nplt.show()\n<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539<code>color<\/code>\u548c<code>radius<\/code>\u53c2\u6570\u6765\u7ed8\u5236\u4e0d\u540c\u989c\u8272\u548c\u5927\u5c0f\u7684\u5706\u3002<\/p>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u4f7f\u7528Python\u7ed8\u5236\u591a\u4e2a\u91cd\u53e0\u7684\u5706\uff1f<\/strong><br \/>\u786e\u5b9e\u53ef\u4ee5\u3002\u53ea\u9700\u5728\u7ed8\u56fe\u533a\u57df\u5185\u591a\u6b21\u6dfb\u52a0<code>Circle<\/code>\u5bf9\u8c61\uff0c\u6bcf\u4e2a\u5bf9\u8c61\u53ef\u4ee5\u6709\u4e0d\u540c\u7684\u5c5e\u6027\u3002\u901a\u8fc7\u8c03\u6574\u6bcf\u4e2a\u5706\u7684\u4f4d\u7f6e\u548c\u6837\u5f0f\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u590d\u6742\u7684\u56fe\u5f62\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">import matplotlib.pyplot as plt\n\nfig, ax = plt.subplots()\nax.add_artist(plt.Circle((0.5, 0.5), 0.3, color=&#39;red&#39;, alpha=0.5))\nax.add_artist(plt.Circle((0.6, 0.6), 0.3, color=&#39;blue&#39;, alpha=0.5))\nax.set_xlim(0, 1)\nax.set_ylim(0, 1)\nplt.gca().set_aspect(&#39;equal&#39;)\nplt.show()\n<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4e24\u4e2a\u5706\u4ee5\u4e0d\u540c\u7684\u989c\u8272\u548c\u900f\u660e\u5ea6\u91cd\u53e0\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u4f7f\u7528\u5176\u4ed6\u5e93\u7ed8\u5236\u5706\uff0c\u4f8b\u5982<code>turtle<\/code>\uff1f<\/strong><br \/><code>turtle<\/code>\u5e93\u662f\u4e00\u4e2a\u975e\u5e38\u9002\u5408\u521d\u5b66\u8005\u7684\u56fe\u5f62\u7ed8\u5236\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u7b80\u5355\u7684\u547d\u4ee4\u7ed8\u5236\u5f62\u72b6\u3002\u8981\u7ed8\u5236\u4e00\u4e2a\u5706\uff0c\u53ef\u4ee5\u4f7f\u7528<code>turtle.circle()<\/code>\u65b9\u6cd5\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u793a\u4f8b\uff1a  <\/p>\n<pre><code class=\"language-python\">import turtle\n\nt = turtle.Turtle()\nt.circle(100)  # \u534a\u5f84\u4e3a100\u7684\u5706\nturtle.done()\n<\/code><\/pre>\n<p>\u901a\u8fc7\u8c03\u6574<code>circle<\/code>\u65b9\u6cd5\u7684\u53c2\u6570\uff0c\u53ef\u4ee5\u63a7\u5236\u5706\u7684\u5927\u5c0f\uff0c<code>turtle<\/code>\u5e93\u63d0\u4f9b\u4e86\u4e00\u4e2a\u76f4\u89c2\u7684\u65b9\u5f0f\u6765\u8fdb\u884c\u56fe\u5f62\u7ed8\u5236\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4f7f\u7528Python\u7f16\u7a0b\u753b\u5706\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528matplotlib\u5e93\u3001turtle\u6a21\u5757\u548cpygame\u5e93\u7b49\u3002\u63a8\u8350 [&hellip;]","protected":false},"author":3,"featured_media":954981,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/954977"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=954977"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/954977\/revisions"}],"predecessor-version":[{"id":954983,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/954977\/revisions\/954983"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/954981"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=954977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=954977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=954977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}