Python调用turtle来实现绘图的方法实现

import turtle as t
首先引入turtle库

我认为在绘图过程中是对库中函数的充分理解
如:
right
left
penup
pendown
forword
backward
speed
pensize
fillcolor
begin_fill
end_fill
rt
fd
epncolor
圆;
circle(半径,角度)
write(‘所写字’,字体设置)
screensize(宽,高,背景色) 绘制时的背景
reset()恢复所有设置
clear()清屏 ,但是画笔仍然停留在原地

*书写自设函数来实现特定图形的绘制
如椭圆
import turtle as t

for i in range(控制椭圆大小):
if 0<=i<30 or60<=i<90:#控制椭圆角度
t.lt(度数)#运动过程中控制所转角度,lt向左转动,rt向右转动
t.fd(步数)#运动过程中控制每转上面的度数所前进的步数

t.done()#控制绘图工具在图形绘制完成后不出现消失的情况
t.mainloop()#也可以实现上述t.done()所实现的功能

猜你喜欢

转载自blog.csdn.net/weixin_43077375/article/details/82186332