本文摘自php中文网,作者coldplay.xixi,侵删。

python画正方形的代码是什么?
python画正方形的代码是:
1 2 3 4 5 6 7 8 9 10 11 | 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中is和==有何区别?Python中is和==的区别介绍
Python笔试题之设计“跳一跳”小游戏计分器
Python怎样求得最大公约数
Python类对象实例对象的区别
Python怎么合并两个字典
详解有关Python上下文管理器和with块
Python字符串连接的几种方式总结
Python在groupby分组后提取指定位置记录方法
Python怎么创建一维数组
一起看看Python 中日志异步发送到远程服务器
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » python画正方形的代码是什么?