窗口控制
screensize(w,h):屏幕大小bgcolor(color):背景颜色clear(),clearscreen():清屏reset(),resetscreen():重置setworldcoordinates():设置世界坐标系
画笔控制
pen = Pen():画笔,返回画笔对象penup()|pu()|up():抬起画笔pendown()|pd()|down():放下画笔pensize(width)|width(w):画笔宽度pencolor(color):画笔颜色fillcolor(color):填充颜色filling():是否填充begin_fill():开始填充end_fill():结束填充isdown():判断画笔是否落下reset():重置clear():清空write(text,**kwargs):绘制文字
海龟控制
position()|pos():位置towards():目标方向xcor()|ycor():x或y的坐标heading():朝向distance():距离degrees():角度radians():弧度hideturtle():隐藏乌龟
移动控制
forward(x)|fd(x):前进x距离backward()|back()|bk():后退right()|rt():右转left()|lt():左转setx()|sety():设置x或y的坐标setheading(to_angle)|seth(to_angle):设置朝向的角度goto(x,y)|setpos()|setposition():前往/定位
图形绘制
circle(半径, 弧度):画圆或弧,其中第二个参数可省略,默认extent=None画一周dot():画点stamp():印章clearstamp():清除印章clearstamps():清除多个印章undo():撤销
系统配置
speed():设置移动速度,0是最快的
本文介绍了Python编程中Turtle库的窗口控制、屏幕背景、画笔设置、海龟移动、图形绘制方法,包括圆弧、点、印章,以及系统配置中的移动速度设定。
1436

被折叠的 条评论
为什么被折叠?



