{"id":1062532,"date":"2024-12-31T15:52:43","date_gmt":"2024-12-31T07:52:43","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1062532.html"},"modified":"2024-12-31T15:52:46","modified_gmt":"2024-12-31T07:52:46","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e7%94%bb%e6%ad%a3%e6%96%b9%e5%bd%a2%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1062532.html","title":{"rendered":"\u5982\u4f55\u7528python\u753b\u6b63\u65b9\u5f62\u6559\u7a0b"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/f06b8c8b-5729-4565-8508-55c0884e62db.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\u5982\u4f55\u7528python\u753b\u6b63\u65b9\u5f62\u6559\u7a0b\" \/><\/p>\n<p><p> <strong>\u4f7f\u7528Python\u753b\u6b63\u65b9\u5f62\u7684\u6559\u7a0b<\/strong><\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528Python\u753b\u6b63\u65b9\u5f62\u7684\u65b9\u6cd5\u6709\u5f88\u591a\u79cd\uff0c\u5e38\u89c1\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528Turtle\u5e93\u3001Matplotlib\u5e93\u548cPygame\u5e93\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e09\u79cd\u5e93\u6765\u753b\u6b63\u65b9\u5f62\u3002\u4ee5\u4e0b\u5185\u5bb9\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Python\u7684Turtle\u5e93\u6765\u753b\u6b63\u65b9\u5f62\u3002<\/strong><\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528Turtle\u5e93\u753b\u6b63\u65b9\u5f62<\/h3>\n<\/p>\n<p><p><strong>Turtle\u5e93\u662fPython\u5185\u7f6e\u7684\u56fe\u5f62\u7ed8\u56fe\u5e93\uff0c\u975e\u5e38\u9002\u5408\u521d\u5b66\u8005\u3002\u5b83\u901a\u8fc7\u63d0\u4f9b\u4e00\u4e2a\u201c\u753b\u7b14\u201d\u6765\u7ed8\u5236\u5404\u79cd\u56fe\u5f62\u3002\u4f7f\u7528Turtle\u5e93\u753b\u6b63\u65b9\u5f62\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u51e0\u884c\u4ee3\u7801\u5373\u53ef\u5b8c\u6210\u3002<\/strong><\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5\u548c\u5bfc\u5165Turtle\u5e93<\/h4>\n<\/p>\n<p><p>Turtle\u5e93\u662fPython\u6807\u51c6\u5e93\u7684\u4e00\u90e8\u5206\uff0c\u56e0\u6b64\u65e0\u9700\u5355\u72ec\u5b89\u88c5\u3002\u53ea\u9700\u5728\u4ee3\u7801\u4e2d\u5bfc\u5165\u5373\u53ef\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import turtle<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u521d\u59cb\u5316Turtle\u5bf9\u8c61<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u521b\u5efa\u4e00\u4e2aTurtle\u5bf9\u8c61\uff0c\u8fd9\u4e2a\u5bf9\u8c61\u5c06\u7528\u4e8e\u7ed8\u5236\u56fe\u5f62\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u521b\u5efaTurtle\u5bf9\u8c61<\/p>\n<p>pen = turtle.Turtle()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u8bbe\u7f6e\u753b\u7b14\u5c5e\u6027<\/h4>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u8bbe\u7f6e\u753b\u7b14\u7684\u989c\u8272\u3001\u5bbd\u5ea6\u7b49\u5c5e\u6027\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8bbe\u7f6e\u753b\u7b14\u989c\u8272\u548c\u5bbd\u5ea6<\/p>\n<p>pen.color(&quot;blue&quot;)<\/p>\n<p>pen.pensize(3)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u753b\u6b63\u65b9\u5f62<\/h4>\n<\/p>\n<p><p>\u73b0\u5728\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Turtle\u5bf9\u8c61\u7684<code>forward<\/code>\u548c<code>right<\/code>\u65b9\u6cd5\u6765\u753b\u4e00\u4e2a\u6b63\u65b9\u5f62\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u753b\u6b63\u65b9\u5f62<\/p>\n<p>for _ in range(4):<\/p>\n<p>    pen.forward(100)  # \u5411\u524d\u79fb\u52a8100\u5355\u4f4d<\/p>\n<p>    pen.right(90)     # \u5411\u53f3\u65cb\u8f6c90\u5ea6<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>5. \u5b8c\u6210\u7ed8\u56fe\u5e76\u663e\u793a<\/h4>\n<\/p>\n<p><p>\u6700\u540e\uff0c\u6211\u4eec\u9700\u8981\u8c03\u7528<code>turtle.done()<\/code>\u65b9\u6cd5\u6765\u5b8c\u6210\u7ed8\u56fe\u5e76\u663e\u793a\u7a97\u53e3\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5b8c\u6210\u7ed8\u56fe<\/p>\n<p>turtle.done()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b8c\u6574\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import turtle<\/p>\n<h2><strong>\u521b\u5efaTurtle\u5bf9\u8c61<\/strong><\/h2>\n<p>pen = turtle.Turtle()<\/p>\n<h2><strong>\u8bbe\u7f6e\u753b\u7b14\u989c\u8272\u548c\u5bbd\u5ea6<\/strong><\/h2>\n<p>pen.color(&quot;blue&quot;)<\/p>\n<p>pen.pensize(3)<\/p>\n<h2><strong>\u753b\u6b63\u65b9\u5f62<\/strong><\/h2>\n<p>for _ in range(4):<\/p>\n<p>    pen.forward(100)<\/p>\n<p>    pen.right(90)<\/p>\n<h2><strong>\u5b8c\u6210\u7ed8\u56fe<\/strong><\/h2>\n<p>turtle.done()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528Matplotlib\u5e93\u753b\u6b63\u65b9\u5f62<\/h3>\n<\/p>\n<p><p><strong>Matplotlib\u5e93\u662fPython\u4e2d\u6700\u6d41\u884c\u7684\u6570\u636e\u53ef\u89c6\u5316\u5e93\u4e4b\u4e00\uff0c\u867d\u7136\u5b83\u4e3b\u8981\u7528\u4e8e\u7ed8\u5236\u56fe\u8868\uff0c\u4f46\u4e5f\u53ef\u4ee5\u7528\u6765\u753b\u57fa\u672c\u56fe\u5f62\u3002\u4f7f\u7528Matplotlib\u753b\u6b63\u65b9\u5f62\u4e5f\u975e\u5e38\u7b80\u5355\u3002<\/strong><\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5\u548c\u5bfc\u5165Matplotlib\u5e93<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5Matplotlib\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install matplotlib<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u5728\u4ee3\u7801\u4e2d\u5bfc\u5165Matplotlib\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import matplotlib.patches as patches<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u521b\u5efa\u7ed8\u56fe\u7a97\u53e3\u548c\u8f74<\/h4>\n<\/p>\n<p><p>\u6211\u4eec\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u7ed8\u56fe\u7a97\u53e3\u548c\u8f74\u5bf9\u8c61\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u521b\u5efa\u7ed8\u56fe\u7a97\u53e3<\/p>\n<p>fig, ax = plt.subplots()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u753b\u6b63\u65b9\u5f62<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528Matplotlib\u7684<code>patches<\/code>\u6a21\u5757\uff0c\u6211\u4eec\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u753b\u4e00\u4e2a\u6b63\u65b9\u5f62\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u521b\u5efa\u4e00\u4e2a\u6b63\u65b9\u5f62<\/p>\n<p>square = patches.Rectangle((0, 0), 1, 1, linewidth=3, edgecolor=&#39;blue&#39;, facecolor=&#39;none&#39;)<\/p>\n<h2><strong>\u6dfb\u52a0\u6b63\u65b9\u5f62\u5230\u8f74<\/strong><\/h2>\n<p>ax.add_patch(square)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u8bbe\u7f6e\u8f74\u7684\u8303\u56f4\u548c\u663e\u793a<\/h4>\n<\/p>\n<p><p>\u6211\u4eec\u9700\u8981\u8bbe\u7f6e\u8f74\u7684\u8303\u56f4\uff0c\u5e76\u663e\u793a\u7ed8\u56fe\u7a97\u53e3\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8bbe\u7f6e\u8f74\u7684\u8303\u56f4<\/p>\n<p>ax.set_xlim(-1, 2)<\/p>\n<p>ax.set_ylim(-1, 2)<\/p>\n<h2><strong>\u663e\u793a\u7ed8\u56fe\u7a97\u53e3<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b8c\u6574\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import matplotlib.patches as patches<\/p>\n<h2><strong>\u521b\u5efa\u7ed8\u56fe\u7a97\u53e3<\/strong><\/h2>\n<p>fig, ax = plt.subplots()<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u6b63\u65b9\u5f62<\/strong><\/h2>\n<p>square = patches.Rectangle((0, 0), 1, 1, linewidth=3, edgecolor=&#39;blue&#39;, facecolor=&#39;none&#39;)<\/p>\n<h2><strong>\u6dfb\u52a0\u6b63\u65b9\u5f62\u5230\u8f74<\/strong><\/h2>\n<p>ax.add_patch(square)<\/p>\n<h2><strong>\u8bbe\u7f6e\u8f74\u7684\u8303\u56f4<\/strong><\/h2>\n<p>ax.set_xlim(-1, 2)<\/p>\n<p>ax.set_ylim(-1, 2)<\/p>\n<h2><strong>\u663e\u793a\u7ed8\u56fe\u7a97\u53e3<\/strong><\/h2>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528Pygame\u5e93\u753b\u6b63\u65b9\u5f62<\/h3>\n<\/p>\n<p><p><strong>Pygame\u5e93\u662f\u4e00\u4e2a\u8de8\u5e73\u53f0\u7684Python\u6a21\u5757\uff0c\u7528\u4e8e\u7f16\u5199\u89c6\u9891\u6e38\u620f\uff0c\u4f46\u5b83\u4e5f\u53ef\u4ee5\u7528\u6765\u753b\u57fa\u672c\u56fe\u5f62\u3002\u4f7f\u7528Pygame\u5e93\u753b\u6b63\u65b9\u5f62\u76f8\u5bf9\u590d\u6742\u4e00\u4e9b\uff0c\u4f46\u4e5f\u975e\u5e38\u7075\u6d3b\u3002<\/strong><\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5\u548c\u5bfc\u5165Pygame\u5e93<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5Pygame\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install pygame<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u5728\u4ee3\u7801\u4e2d\u5bfc\u5165Pygame\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pygame<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u521d\u59cb\u5316Pygame<\/h4>\n<\/p>\n<p><p>\u6211\u4eec\u9700\u8981\u521d\u59cb\u5316Pygame\u5e76\u521b\u5efa\u4e00\u4e2a\u7a97\u53e3\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u521d\u59cb\u5316Pygame<\/p>\n<p>pygame.init()<\/p>\n<h2><strong>\u521b\u5efa\u7a97\u53e3<\/strong><\/h2>\n<p>screen = pygame.display.set_mode((400, 400))<\/p>\n<p>pygame.display.set_caption(&quot;Draw Square&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u8bbe\u7f6e\u989c\u8272<\/h4>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u5b9a\u4e49\u4e00\u4e9b\u989c\u8272\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5b9a\u4e49\u989c\u8272<\/p>\n<p>WHITE = (255, 255, 255)<\/p>\n<p>BLUE = (0, 0, 255)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u753b\u6b63\u65b9\u5f62<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528Pygame\u7684<code>draw<\/code>\u6a21\u5757\uff0c\u6211\u4eec\u53ef\u4ee5\u753b\u4e00\u4e2a\u6b63\u65b9\u5f62\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u753b\u6b63\u65b9\u5f62<\/p>\n<p>pygame.draw.rect(screen, BLUE, (150, 150, 100, 100), 3)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>5. \u66f4\u65b0\u663e\u793a\u548c\u4e8b\u4ef6\u5faa\u73af<\/h4>\n<\/p>\n<p><p>\u6211\u4eec\u9700\u8981\u66f4\u65b0\u663e\u793a\u5e76\u5904\u7406\u4e8b\u4ef6\u5faa\u73af\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u66f4\u65b0\u663e\u793a<\/p>\n<p>pygame.display.flip()<\/p>\n<h2><strong>\u4e8b\u4ef6\u5faa\u73af<\/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>\u5b8c\u6574\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/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\u7a97\u53e3<\/strong><\/h2>\n<p>screen = pygame.display.set_mode((400, 400))<\/p>\n<p>pygame.display.set_caption(&quot;Draw Square&quot;)<\/p>\n<h2><strong>\u5b9a\u4e49\u989c\u8272<\/strong><\/h2>\n<p>WHITE = (255, 255, 255)<\/p>\n<p>BLUE = (0, 0, 255)<\/p>\n<h2><strong>\u586b\u5145\u80cc\u666f<\/strong><\/h2>\n<p>screen.fill(WHITE)<\/p>\n<h2><strong>\u753b\u6b63\u65b9\u5f62<\/strong><\/h2>\n<p>pygame.draw.rect(screen, BLUE, (150, 150, 100, 100), 3)<\/p>\n<h2><strong>\u66f4\u65b0\u663e\u793a<\/strong><\/h2>\n<p>pygame.display.flip()<\/p>\n<h2><strong>\u4e8b\u4ef6\u5faa\u73af<\/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><h3>\u56db\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p><strong>\u4ee5\u4e0a\u4ecb\u7ecd\u4e86\u4f7f\u7528Python\u753b\u6b63\u65b9\u5f62\u7684\u4e09\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528Turtle\u5e93\u3001Matplotlib\u5e93\u548cPygame\u5e93\u3002<\/strong> <strong>Turtle\u5e93\u9002\u5408\u521d\u5b66\u8005\uff0c\u4ee3\u7801\u7b80\u5355\u6613\u61c2\uff1bMatplotlib\u5e93\u9002\u5408\u9700\u8981\u6570\u636e\u53ef\u89c6\u5316\u7684\u573a\u666f\uff1bPygame\u5e93\u9002\u5408\u9700\u8981\u66f4\u591a\u7075\u6d3b\u6027\u548c\u4ea4\u4e92\u6027\u7684\u573a\u666f\u3002<\/strong> <strong>\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\uff0c\u80fd\u591f\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u5b8c\u6210\u4efb\u52a1\u3002<\/strong><\/p>\n<\/p>\n<p><p>\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff0c\u795d\u4f60\u5728Python\u7ed8\u56fe\u7684\u9053\u8def\u4e0a\u4e0d\u65ad\u8fdb\u6b65\uff01<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u4f7f\u7528\u4e0d\u540c\u7684\u5e93\u7ed8\u5236\u6b63\u65b9\u5f62\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u6709\u591a\u4e2a\u5e93\u53ef\u4ee5\u7ed8\u5236\u6b63\u65b9\u5f62\uff0c\u6700\u5e38\u7528\u7684\u5305\u62ecMatplotlib\u548cTurtle\u3002\u4f7f\u7528Matplotlib\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u7ed8\u5236\u56db\u6761\u7ebf\u6bb5\u6765\u5f62\u6210\u6b63\u65b9\u5f62\uff1b\u800cTurtle\u5e93\u5219\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u7ed8\u56fe\u547d\u4ee4\uff0c\u975e\u5e38\u9002\u5408\u521d\u5b66\u8005\u3002\u53ea\u9700\u9009\u62e9\u9002\u5408\u81ea\u5df1\u9700\u6c42\u7684\u5e93\uff0c\u5c31\u53ef\u4ee5\u8f7b\u677e\u7ed8\u5236\u6b63\u65b9\u5f62\u3002<\/p>\n<p><strong>\u5728\u7ed8\u5236\u6b63\u65b9\u5f62\u65f6\uff0c\u5982\u4f55\u8bbe\u7f6e\u989c\u8272\u548c\u7ebf\u6761\u6837\u5f0f\uff1f<\/strong><br \/>\u65e0\u8bba\u662f\u4f7f\u7528Matplotlib\u8fd8\u662fTurtle\u5e93\uff0c\u90fd\u53ef\u4ee5\u81ea\u5b9a\u4e49\u989c\u8272\u548c\u7ebf\u6761\u6837\u5f0f\u3002\u5728Matplotlib\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570\u8bbe\u7f6e\u8fb9\u6846\u989c\u8272\u548c\u7ebf\u6761\u5bbd\u5ea6\uff1b\u5728Turtle\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pencolor()<\/code>\u548c<code>pensize()<\/code>\u51fd\u6570\u6765\u8c03\u6574\u7ed8\u56fe\u989c\u8272\u548c\u7ebf\u6761\u7c97\u7ec6\u3002\u8fd9\u4f7f\u5f97\u6b63\u65b9\u5f62\u7684\u7ed8\u5236\u4e0d\u4ec5\u9650\u4e8e\u57fa\u672c\u5f62\u72b6\uff0c\u8fd8\u53ef\u4ee5\u66f4\u52a0\u4e2a\u6027\u5316\u3002<\/p>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u5728Python\u4e2d\u7ed8\u5236\u586b\u5145\u989c\u8272\u7684\u6b63\u65b9\u5f62\uff1f<\/strong><br \/>\u5f53\u7136\u53ef\u4ee5\uff01\u5728Matplotlib\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5728<code>fill()<\/code>\u51fd\u6570\u4e2d\u6307\u5b9a\u989c\u8272\u6765\u586b\u5145\u6b63\u65b9\u5f62\uff1b\u5728Turtle\u4e2d\uff0c\u4f7f\u7528<code>begin_fill()<\/code>\u548c<code>end_fill()<\/code>\u547d\u4ee4\u53ef\u4ee5\u5b9e\u73b0\u586b\u5145\u6548\u679c\u3002\u8fd9\u6837\uff0c\u4e0d\u4ec5\u80fd\u591f\u7ed8\u5236\u51fa\u8fb9\u754c\u6e05\u6670\u7684\u6b63\u65b9\u5f62\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u5176\u66f4\u52a0\u751f\u52a8\u6709\u8da3\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4f7f\u7528Python\u753b\u6b63\u65b9\u5f62\u7684\u6559\u7a0b \u4f7f\u7528Python\u753b\u6b63\u65b9\u5f62\u7684\u65b9\u6cd5\u6709\u5f88\u591a\u79cd\uff0c\u5e38\u89c1\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528Turtle\u5e93\u3001Ma [&hellip;]","protected":false},"author":3,"featured_media":1062543,"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\/1062532"}],"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=1062532"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1062532\/revisions"}],"predecessor-version":[{"id":1062547,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1062532\/revisions\/1062547"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1062543"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1062532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1062532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1062532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}