python怎么用自定义函数画手朝左边的小人

Python012

python怎么用自定义函数画手朝左边的小人,第1张

可以插函数。turtle.setup(700,700,100,100)#setup()设置窗体大小,后两个参数可选,该函数也不是必须的

turtle.speed(10)#设置画笔移到速度,参数值为0-10,数字越大,速度越大

turtle.pensize(10)#设置画笔尺寸大小

turtle.pencolor(‘green‘)#设置画笔颜色

turtle.penup()#将画笔抬起(抬起时移到画笔将不会在画布留下痕迹)

turtle.goto(0,190)#将画笔移到(x,y)

turtle.pendown()#将画笔落下

turtle.circle(80,360)#画圆,半径为正表示圆心在画笔左边

from turtle import *

from random import *

for i in range(4):

begin_fill()

penup()

goto(0, 30*(i+1)) # 从里面最小的一个圆的底部,慢慢变大

fillcolor((random(), random(), random()))

pendown()

circle(150-30*(i+1))

end_fill()

mainloop()