python画正方形的代码是什么?

python画正方形的代码是:import turtle #导入

turtle.title("画正方形")

turtle.pensize(5) #画笔大小为5

turtle.pencolor("red") #画笔颜色为红

turtle.fillcolor("green") #填充颜色为绿

turtle.begin_fill() #开始填充

for i in range(4): #循环四次

turtle.forward(200) #前进200

turtle.left(90) #左转90度

turtle.end_fill() #结束填充

turtle.done() #导入结束

以上就是python画正方形的代码是什么?的详细内容,更多请关注php中文网其它相关文章!

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

更多推荐

python画正方形的代码_python画正方形的代码是什么?