# python画图代码turtle-Python学习之turtle绘图篇

from turtle import *color('red','red')

begin_fill()for i in range(5):

fd(200)

rt(144)

end_fill()

done()

#PythonDraw.py

importturtle#turtle.setup(650,350,200,200)

turtle.penup()

turtle.fd(-250)

turtle.pendown()

turtle.pensize(25)

turtle.pencolor("purple")

turtle.seth(-40)for i in range(4):

turtle.circle(40,80)

turtle.circle(-40,80)

turtle.circle(40,80/2)

turtle.fd(40)

turtle.circle(16,180)

turtle.fd(40*2/3)

importturtle

turtle.pensize(2)

turtle.circle(10)

turtle.circle(40)

turtle.circle(80)

turtle.circle(120)

from turtle import *

defnose(x,y):

pu()

goto(x,y)

pd()

seth(-30)

begin_fill()

a=0.4

for i in range(120):if 0<=i<30 or 60<=i<90:

a=a+0.08lt(3)

fd(a)else:

a=a-0.08lt(3)

fd(a)

end_fill()

pu()

seth(90)

fd(25)

seth(0)

fd(10)

pd()

pencolor(255,155,192)

seth(10)

begin_fill()

circle(5)

color(160,82,45)

end_fill()

pu()

seth(0)

fd(20)

pd()

pencolor(255,155,192)

seth(10)

begin_fill()

circle(5)

color(160,82,45)

color((255,155,192),"pink")

pu()

goto(x,y)

seth(0)

pd()

begin_fill()

seth(180)

circle(300,-30)

circle(100,-60)

circle(80,-100)

circle(150,-20)

circle(60,-95)

seth(161)

circle(-300,15)

pu()

goto(-100,100)

pd()

seth(-30)

a=0.4

for i in range(60):if 0<=i<30 or 60<=i<90:

a=a+0.08lt(3)

fd(a)else:

a=a-0.08lt(3)

fd(a)

end_fill()defears(x,y):

color((255,155,192),"pink")

pu()

goto(x,y)

pd()

begin_fill()

seth(100)

circle(-50,50)

circle(-10,120)

circle(-50,54)

end_fill()

pu()

seth(90)

fd(-12)

seth(0)

fd(30)

pd()

begin_fill()

seth(100)

circle(-50,50)

circle(-10,120)

circle(-50,56)

end_fill()defeyes(x,y):

color((255,155,192),"white")

pu()

seth(90)

fd(-20)

seth(0)

fd(-95)

pd()

begin_fill()

circle(15)

end_fill()

color("black")

pu()

seth(90)

fd(12)

seth(0)

fd(-3)

pd()

begin_fill()

circle(3)

end_fill()

color((255,155,192),"white")

pu()

seth(90)

fd(-25)

seth(0)

fd(40)

pd()

begin_fill()

circle(15)

end_fill()

color("black")

pu()

seth(90)

fd(12)

seth(0)

fd(-3)

pd()

begin_fill()

circle(3)

end_fill()defcheek(x,y):

color((255,155,192))

pu()

goto(x,y)

pd()

seth(0)

begin_fill()

circle(30)

end_fill()defmouth(x,y):

color(239,69,19)

pu()

goto(x,y)

pd()

seth(-80)

circle(30,40)

circle(40,80)defbody(x,y):

color("red",(255,99,71))

pu()

goto(x,y)

pd()

begin_fill()

seth(-130)

circle(100,10)

circle(300,30)

seth(0)

fd(230)

seth(90)

circle(300,30)

circle(100,3)

color((255,155,192),(255,100,100))

seth(-135)

circle(-80,63)

circle(-150,24)

end_fill()defhands(x,y):

color((255,155,192))

pu()

goto(x,y)

pd()

seth(-160)

circle(300,15)

pu()

seth(90)

fd(15)

seth(0)

fd(0)

pd()

seth(-10)

circle(-20,90)

pu()

seth(90)

fd(30)

seth(0)

fd(237)

pd()

seth(-20)

circle(-300,15)

pu()

seth(90)

fd(20)

seth(0)

fd(0)

pd()

seth(-170)

circle(20,90)deffoot(x,y):

pensize(10)

color((240,128,128))

pu()

goto(x,y)

pd()

seth(-90)

fd(40)

seth(-180)

color("black")

pensize(15)

fd(20)

pensize(10)

color((240,128,128))

pu()

seth(90)

fd(40)

seth(0)

fd(90)

pd()

seth(-90)

fd(40)

seth(-180)

color("black")

pensize(15)

fd(20)deftail(x,y):

pensize(4)

color((255,155,192))

pu()

goto(x,y)

pd()

seth(0)

circle(70,20)

circle(10,330)

circle(70,30)defsetting():

pensize(4)

hideturtle()

colormode(255)

color((255,155,192),"pink")

setup(840,500)

speed(10)defmain():

setting()

nose(-100,100)

ears(0,160)

eyes(0,140)

cheek(80,10)

mouth(-20,30)

body(-32,-8)

hands(-56,-45)

foot(2,-177)

tail(148,-155)

done()

main()

turtle.setup(width,height,startx,starty)设置窗体大小及位置，后面两个参数可选，非必需

turtle.bk(d)向海龟的反方向运行

turtle.circle(r,angle)以海龟左边的某一点为圆心进行曲线运行

RGB体系：turtle.colormode(mode)mode=1.0则改用0和1表示，mode=255则改用255和0表示，默认为小数

08-05
02-03 3706

09-06 1349
08-22
05-11
11-25 8433
04-16 3969
08-03 9074
02-21 342
©️2022 CSDN 皮肤主题：1024 设计师：我叫白小胖

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、C币套餐、付费专栏及课程。