记录我的Python学习之旅(一)关于turtle库的基本用法

关于库函数的导入方法:①import <> ②import <> as <> ③ from tutle import <>

1、turtle.setup(width,height,startx,starty)  //起始点坐标:左上角相对于屏幕的坐标,默认在屏幕中央

2、turtle.goto(x,y)//将海龟走到该坐标位置 //绝对坐标

3、turtle.bk(d)//海龟后退 //海龟坐标

4、turtle.fd(d)//海龟前进

5、turtle.circle(r,angle)//海龟左侧某一点为圆心曲线运行

6、turtle.seth(angle)//海龟转向,绝对坐标

7、turtle.left(angle)左转

8、turtle.right(angle)右转

9、penup()抬起画笔

10、pendown()落下画笔

11、pencolor()笔的颜色

12、pensize()笔的大小

13、turtle.colormode(mode)//改变RGB模式,mode=1.0小数值,mode=255整数值

RGB颜色,如white的RGB整数值为:255.255.255,修改数值可以改变颜色

14、turtle.done() 画完之后不关闭窗口

15、turtle.hideturtle() 隐藏海龟

猜你喜欢

转载自www.cnblogs.com/haimianbaobao7/p/9992689.html