python3.7怎么安装turtle_python怎么安装turtle
turtle庫(kù)是Python語(yǔ)言中一個(gè)很流行的繪制圖像的函數(shù)庫(kù),想象一個(gè)小烏龜,在一個(gè)橫軸為x、縱軸為y的坐標(biāo)系原點(diǎn),(0,0)位置開(kāi)始,它根據(jù)一組函數(shù)指令的控制,在這個(gè)平面坐標(biāo)系中移動(dòng),從而在它爬行的路徑上繪制了圖形。
安裝turtle(推薦學(xué)習(xí):Python視頻教程)
Python2安裝命令:pip install turtule
Python3安裝命令:pip3 install turtle
繪圖舉例
太陽(yáng)花import turtle as timport time
t.color("red", "yellow")
t.speed(10)
t.begin_fill()for _ in range(50):
t.forward(200)
t.left(170)
end_fill()
time.sleep(1)
繪制五角星import turtleimport time
turtle.pensize(5)
turtle.pencolor("yellow")
turtle.fillcolor("red")
turtle.begin_fill()for _ in range(5):
turtle.forward(200)
turtle.right(144)
turtle.end_fill()
time.sleep(2)
turtle.penup()
turtle.goto(-150,-120)
turtle.color("violet")
turtle.write("Done", font=('Arial', 40, 'normal'))
time.sleep(1)
更多Python相關(guān)技術(shù)文章,請(qǐng)?jiān)L問(wèn)Python教程欄目進(jìn)行學(xué)習(xí)!
以上就是python怎么安裝turtle的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注php中文網(wǎng)其它相關(guān)文章!
本文原創(chuàng)發(fā)布php中文網(wǎng),轉(zhuǎn)載請(qǐng)注明出處,感謝您的尊重!
總結(jié)
以上是生活随笔為你收集整理的python3.7怎么安装turtle_python怎么安装turtle的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: python中str用法_python数
- 下一篇: python语言是机器语言_Python