Skip to main content
 首页 » 编程设计

python之为什么 turtle.circle(r,extent=720,steps=5) 在 python 中画了一颗星

2024年10月01日8rubylouvre

今天无意中测试了这段代码:

import turtle 
 
turtle.circle(70,extent=720,steps=5) 

turtle 为我画了这个:

有人知道为什么会这样吗?

请您参考如下方法:

turtle.circle 不画圆。作为documented在官方文档中,

the circle is approximated by an inscribed regular polygon

指定 extent=720 表示绘制 720 度(近似)圆,指定 steps=5 表示使用 5 边形来近似圆。绕 720 度的 5 边正多边形是标准的 5 边星。