Draw octagon

The program requires to draw an octagon, the commands are similar, only the circle command has something to say:

circle(radius, extent=None, steps=None) draws a circle and consists of 3 parameters. The first parameter represents the radius of the circle, the second parameter represents the arc radius, and the third parameter represents the number of sides.

from turtle import *#导入海龟画图
ht()#隐藏画笔
pensize(5)
color('black','green')#画笔颜色为黑色、填充色为绿色
begin_fill()#开始填充
circle(100,steps=8)#圆半径100,边数为8或要画10边形,那么此参数为10(steps)
end_fill()#结束填充
done()

 

Guess you like

Origin blog.csdn.net/weixin_43115314/article/details/114250928