python画正方形的代码是什么?-Python教程

资源魔 36 0

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视频教程》

以上就是python画正方形的代码是甚么?的具体内容,更多请存眷资源魔其它相干文章!

标签: Python python教程 python编程 python使用问题 画正方形

抱歉,评论功能暂时关闭!