您好,欢迎访问一九零五行业门户网

python怎么安装turtle

turtle库是python语言中一个很流行的绘制图像的函数库,想象一个小乌龟,在一个横轴为x、纵轴为y的坐标系原点,(0,0)位置开始,它根据一组函数指令的控制,在这个平面坐标系中移动,从而在它爬行的路径上绘制了图形。
安装turtle(推荐学习:python视频教程)
python2安装命令:
pip install turtule
python3安装命令:
pip3 install turtle
绘图举例
太阳花
import turtle as timport timet.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 timeturtle.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相关技术文章,请访问python教程栏目进行学习!
以上就是python怎么安装turtle的详细内容。
其它类似信息

推荐信息