turtle.seth函数
2021-08-03 本文已影响0人
看远方的星
![](https://img.haomeiwen.com/i14371593/8361beed6e2df3bf.png)
画笔停止后,默认回到0度方向也就是向东
绘制上图的代码:
t.seth(0)
t.fd(100)
t.write("0-东")
t.home()
t.seth(90)
t.fd(100)
t.write("90-北")
t.home()
t.seth(180)
t.fd(100)
t.write("180-西")
t.home()
t.seth(270)
t.fd(100)
t.write("270-南")
t.home()
例:画出一个等边三角形,使用seth函数:
import turtle as t
for i in range(1,4):
t.fd(100)
t.seth(i*120)
![](https://img.haomeiwen.com/i14371593/f6c8ec0152e9405d.png)