{"id":293,"date":"2025-10-10T15:11:05","date_gmt":"2025-10-10T07:11:05","guid":{"rendered":"http:\/\/www.pyteam.cn\/?p=293"},"modified":"2025-10-14T14:44:15","modified_gmt":"2025-10-14T06:44:15","slug":"%e8%ae%be%e7%bd%ae%e7%94%bb%e5%b8%83%ef%bc%88canvas%ef%bc%89-10-2","status":"publish","type":"post","link":"http:\/\/www.pyteam.cn\/index.php\/2025\/10\/10\/%e8%ae%be%e7%bd%ae%e7%94%bb%e5%b8%83%ef%bc%88canvas%ef%bc%89-10-2\/","title":{"rendered":"\u8bbe\u7f6e\u753b\u5e03\uff08Canvas\uff09 10.2"},"content":{"rendered":"\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:clamp(18px, 1.125rem, 27px);font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#90A4AE;--cbp-line-number-width:calc(1 * 0.6 * 1.125rem);line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#ededed;color:#8198a3\">Python<\/span><span role=\"button\" tabindex=\"0\" style=\"color:#90A4AE;display:none\" aria-label=\"\u590d\u5236\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly># \u8bbe\u7f6e\u753b\u5e03\u5927\u5c0f\uff08\u5bbd, \u9ad8\uff09\u548c\u80cc\u666f\u989c\u8272\nt.setup(width=800, height=600)  # \u521b\u5efa\u4e00\u4e2a800x600\u50cf\u7d20\u7684\u7a97\u53e3\nt.bgcolor(\"lightblue\")          # \u8bbe\u7f6e\u80cc\u666f\u8272\u4e3a\u6d45\u84dd\u8272\nt.title(\"\u6211\u7684\u76f4\u89d2\u5750\u6807\u7cfb\")       # \u8bbe\u7f6e\u7a97\u53e3\u6807\u9898<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-lighter\" style=\"background-color: #FAFAFA\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #90A4AE; font-style: italic\"># \u8bbe\u7f6e\u753b\u5e03\u5927\u5c0f\uff08\u5bbd, \u9ad8\uff09\u548c\u80cc\u666f\u989c\u8272<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">t<\/span><span style=\"color: #39ADB5\">.<\/span><span style=\"color: #6182B8\">setup<\/span><span style=\"color: #39ADB5\">(<\/span><span style=\"color: #90A4AE; font-style: italic\">width<\/span><span style=\"color: #39ADB5\">=<\/span><span style=\"color: #F76D47\">800<\/span><span style=\"color: #39ADB5\">,<\/span><span style=\"color: #6182B8\"> <\/span><span style=\"color: #90A4AE; font-style: italic\">height<\/span><span style=\"color: #39ADB5\">=<\/span><span style=\"color: #F76D47\">600<\/span><span style=\"color: #39ADB5\">)<\/span><span style=\"color: #90A4AE\">  <\/span><span style=\"color: #90A4AE; font-style: italic\"># \u521b\u5efa\u4e00\u4e2a800x600\u50cf\u7d20\u7684\u7a97\u53e3<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">t<\/span><span style=\"color: #39ADB5\">.<\/span><span style=\"color: #6182B8\">bgcolor<\/span><span style=\"color: #39ADB5\">(<\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #91B859\">lightblue<\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #39ADB5\">)<\/span><span style=\"color: #90A4AE\">          <\/span><span style=\"color: #90A4AE; font-style: italic\"># \u8bbe\u7f6e\u80cc\u666f\u8272\u4e3a\u6d45\u84dd\u8272<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">t<\/span><span style=\"color: #39ADB5\">.<\/span><span style=\"color: #6182B8\">title<\/span><span style=\"color: #39ADB5\">(<\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #91B859\">\u6211\u7684\u76f4\u89d2\u5750\u6807\u7cfb<\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #39ADB5\">)<\/span><span style=\"color: #90A4AE\">       <\/span><span style=\"color: #90A4AE; font-style: italic\"># \u8bbe\u7f6e\u7a97\u53e3\u6807\u9898<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":422,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,5],"tags":[],"class_list":["post-293","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-turtle","category-5"],"views":113,"_links":{"self":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/comments?post=293"}],"version-history":[{"count":1,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/293\/revisions"}],"predecessor-version":[{"id":294,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/293\/revisions\/294"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/media\/422"}],"wp:attachment":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/media?parent=293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/categories?post=293"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/tags?post=293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}