当前第2页 返回上一页
3.接着我们就开始编辑代码了,首先我们要明确用到的函数有turtle.left、turtle.right和turtle.forward函数。代码如下:
1 2 3 | import turtle
turtle.left(90)
turtle.forward(100)
|
先叫出龟,左转90,直行100
1 2 3 4 5 6 | turtle.right(90)
turtle.forward(150)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(150)
|
右转,直行,右转,直行,就OK啦。
角度没什么都是90度。
运行结果

以上就是Python如何绘制长方形的详细内容,更多文章请关注木庄网络博客!!
返回前面的内容
相关阅读 >>
Python的format怎么用
Python单引号、双引号、三引号的区别
Python int什么意思
Python开发什么
Python标准库需要导入吗
图解Python变量与赋值
Python怎么统计不同字符的个数
Python初学者看什么书
Python阶乘函数怎么使用
Python之图形的绘制
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » Python如何绘制长方形