手機(jī)也能上課
![App下載](http://7nsts.w3cschool.cn/images/w3c/app-qrcode2.png)
1/2
移動(dòng)命令
命令
|
說(shuō)明
|
turtle.forward(distance)
|
向當(dāng)前畫(huà)筆方向移動(dòng)distance像素長(zhǎng)度
|
turtle.backward(distance)
|
向當(dāng)前畫(huà)筆相反方向移動(dòng)distance像素長(zhǎng)度
|
turtle.right(degree)
|
順時(shí)針轉(zhuǎn)動(dòng)degree°
|
turtle.left(degree)
|
逆時(shí)針轉(zhuǎn)動(dòng)degree°
|
turtle.pendown()
|
放下畫(huà)筆,移動(dòng)時(shí)繪制圖形,默認(rèn)為繪制
|
turtle.goto(x,y)
|
將畫(huà)筆移動(dòng)到坐標(biāo)為x,y的位置
|
turtle.penup()
|
提起畫(huà)筆,移動(dòng)時(shí)不繪制圖形,用于另起一個(gè)地方繪制
|
turtle.circle()
|
畫(huà)圓,半徑為正(負(fù)),表示圓心在畫(huà)筆的左邊(右邊)畫(huà)圓
|
setx( )
|
將當(dāng)前x軸移動(dòng)到指定位置
|
sety( )
|
將當(dāng)前y軸移動(dòng)到指定位置
|
setheading(angle)/seth(angle)
|
設(shè)置當(dāng)前朝向?yàn)閍ngle角度
|
home()
|
設(shè)置當(dāng)前畫(huà)筆位置為原點(diǎn),朝向東。
|
dot(r)
|
繪制一個(gè)指定直徑和顏色的圓點(diǎn)
|
distance為傳入的數(shù)值,代表移動(dòng)的長(zhǎng)度。
degree為傳入的數(shù)值,代表轉(zhuǎn)動(dòng)的角度。
angle為傳入的數(shù)值,以右邊(東邊)為0。當(dāng)設(shè)置為0時(shí)朝向右邊(東邊),設(shè)置為90時(shí)朝向北邊(上邊),以此類(lèi)推。