用python画柯南

一、几个参数
  • 代码第四行tl.speed()中的8代表画图的速度,可以设置其他整数
  • 中间代码比较麻烦,都是各种函数的调用,可自行研究
  • 倒数第六行和倒数第四行代码可设置字体颜色
  • 倒数第五行和倒数第三行是祝福话语,可自行编辑
  • 倒数第二行是画图结束后程序暂停2.5秒后自动关闭
二、效果图

柯南效果图

三、代码
#生日礼物
#author:舒傲寒
#sendTo:小朋友
import turtle as tl
import time
tl.setup(1580,800,0,0)
tl.speed(8)
tl.pensize(3)
tl.up()
tl.goto(0,-190)
tl.seth(90)
tl.fd(110)
tl.seth(10)
tl.fd(-15)
tl.pd()
tl.fd(-10)
tl.up()
tl.goto(0,-80)
tl.seth(-5)
tl.pd()
tl.fd(40)
tl.up()
tl.goto(0,-25)
tl.seth(0)
tl.pd()
tl.circle(12,90)
tl.seth(135)
tl.circle(-35,45)
tl.seth(-125)
tl.circle(40,60)
tl.up()
tl.goto(0,210)
tl.seth(167)
tl.pd()
tl.fillcolor("black")
tl.begin_fill()
tl.circle(910,26)
tl.seth(230)
tl.circle(145,80)
tl.circle(225,43)
tl.circle(225,43)
tl.circle(170,90)
tl.end_fill()
tl.up()
tl.fd(-17)
tl.seth(171)
tl.pd()
tl.fillcolor("white")
tl.begin_fill()
tl.circle(910,22)
tl.seth(232)
tl.circle(145,83)
tl.circle(223,42)
tl.circle(223,42)
tl.circle(167,90)
tl.end_fill()
tl.up()
tl.goto(0,210)
tl.seth(13)
tl.pd()
tl.fillcolor("black")
tl.begin_fill()
tl.circle(-910,26)
tl.seth(-50)
tl.circle(-145,80)
tl.circle(-225,43)
tl.circle(-225,43)
tl.circle(-170,90)
tl.end_fill()
tl.up()
tl.fd(-17)
tl.seth(9)
tl.pd()
tl.fillcolor("white")
tl.begin_fill()
tl.circle(-910,22)
tl.seth(-52)
tl.circle(-145,83)
tl.circle(-223,42)
tl.circle(-223,42)
tl.circle(-167,90)
tl.end_fill()
tl.up()
tl.goto(0,-190)
tl.seth(170)
tl.pd()
tl.circle(-580,25)
tl.circle(-120,30)
tl.circle(620,22)
tl.circle(-380,35)
tl.up()
tl.goto(0,-190)
tl.seth(10)
tl.pd()
tl.circle(580,30)
tl.circle(120,25)
tl.circle(-620,22)
tl.circle(380,35)
tl.up()
tl.goto(-185,160)
tl.seth(-65)
tl.pd()
tl.fillcolor("black")
tl.begin_fill()
tl.circle(-45,220)
tl.circle(-190,10)
tl.up()
tl.goto(-185,160)
tl.seth(160)
tl.pd()
tl.pensize(6)
tl.fd(-15)
tl.fd(93)
tl.end_fill()
tl.seth(190)
tl.circle(160,35)
tl.left(90)
tl.fd(8)
tl.pensize(5)
tl.fd(7)
tl.pensize(4)
tl.fd(6)
tl.pensize(3)
tl.fd(5)
tl.up()
tl.fd(45)
tl.seth(0)
tl.fd(15)
tl.pd()
tl.seth(-40)
tl.circle(55,95)
tl.up()
tl.goto(185,160)
tl.seth(245)
tl.pd()
tl.fillcolor("black")
tl.begin_fill()
tl.circle(45,220)
tl.circle(190,10)
tl.up()
tl.goto(185,160)
tl.seth(20)
tl.pd()
tl.pensize(6)
tl.fd(-35)
tl.fd(113)
tl.end_fill()
tl.seth(-10)
tl.circle(-150,35)
tl.right(90)
tl.fd(8)
tl.pensize(5)
tl.fd(7)
tl.pensize(4)
tl.fd(6)
tl.pensize(3)
tl.fd(5)
tl.up()
tl.fd(45)
tl.seth(180)
tl.fd(15)
tl.seth(220)
tl.circle(-55,95)
tl.seth(-30)
tl.pd()
tl.circle(95,70)
tl.up()
tl.pencolor("white")
tl.pensize(7)
tl.goto(-255,180)
tl.seth(-75)
tl.pd()
tl.fd(82)
tl.up()
tl.pensize(4)
tl.goto(-267,148)
tl.pd()
tl.fd(35)
tl.pencolor("black")
tl.pensize(3)
tl.up()
tl.goto(-185,160)
tl.seth(-65)
tl.pd()
tl.fillcolor("white")
tl.begin_fill()
tl.circle(-30,220)
tl.circle(-150,8)
tl.end_fill()
tl.up()
tl.pencolor("white")
tl.pensize(9)
tl.goto(210,145)
tl.seth(-75)
tl.pd()
tl.fd(48)
tl.up()
tl.goto(183,148)
tl.pd()
tl.pensize(4)
tl.fd(45)
tl.pencolor("black")
tl.pensize(3)
tl.up()
tl.goto(185,160)
tl.seth(20)
tl.fd(20)
tl.seth(245)
tl.pd()
tl.fillcolor("white")
tl.begin_fill()
tl.circle(35,220)
tl.circle(145,11)
tl.end_fill()
tl.up()
tl.goto(-251,-80)
tl.pd()
tl.seth(170)
tl.circle(-350,70)
tl.circle(-30,170)
tl.up()
tl.goto(-280,-30)
tl.seth(176)
tl.pd()
tl.circle(-190,60)
tl.up()
tl.goto(-330,50)
tl.pd()
tl.seth(150)
tl.circle(135,45)
tl.up()
tl.goto(251,-80)
tl.pd()
tl.seth(10)
tl.circle(350,75)
tl.circle(17,170)
tl.up()
tl.goto(297,-30)
tl.seth(4)
tl.pd()
tl.circle(190,80)
tl.up()
tl.goto(348,50)
tl.pd()
tl.seth(45)
tl.circle(-165,45)
tl.up()
tl.goto(348,50)
tl.seth(60)
tl.pd()
tl.circle(-200,56)
tl.up()
tl.goto(-640,395)
tl.pd()
tl.seth(-160)
tl.circle(155,60)
tl.seth(70)
tl.circle(-174,72)
tl.seth(-140)
tl.circle(320,45)
tl.circle(120,45)
tl.seth(85)
tl.circle(-360,55)
tl.up()
tl.goto(-500,395)
tl.pd()
tl.seth(-120)
tl.circle(350,45)
tl.up()
tl.goto(-500,395)
tl.pd()
tl.pensize(1)
tl.seth(-150)
tl.circle(375,50)
tl.up()
tl.goto(-500,395)
tl.pd()
tl.pensize(3)
tl.seth(-120)
tl.circle(350,45)
tl.seth(90)
tl.circle(-380,47)
tl.seth(0)
tl.fd(30)
tl.seth(-130)
tl.circle(380,15)
tl.seth(40)
tl.circle(-380,25)
tl.up()
tl.seth(0)
tl.fd(-80)
tl.seth(-130)
tl.pd()
tl.circle(360,7)
tl.seth(40)
tl.circle(-380,22)
tl.up()
tl.goto(-500,395)
tl.seth(-110)
tl.pd()
tl.circle(375,27)
tl.seth(-90)
tl.circle(140,100)
tl.seth(138)
tl.circle(-510,14)
tl.circle(-65,70)
tl.fd(30)
tl.up()
tl.seth(90)
tl.fd(25)
tl.pd()
tl.seth(-95)
tl.circle(180,36)
tl.seth(100)
tl.circle(-200,23)
tl.circle(-130,45)
tl.fd(35)
tl.seth(-135)
tl.circle(230,43)
tl.seth(45)
tl.circle(230,43)
tl.seth(-110)
tl.circle(200,45)
tl.seth(100)
tl.circle(-170,38)
tl.up()
tl.seth(76)
tl.fd(35)
tl.pd()
tl.fillcolor("white")
tl.begin_fill()
tl.seth(-107)
tl.circle(253,50)
tl.seth(103)
tl.circle(-200,43)
tl.end_fill()
tl.up()
tl.fd(42)
tl.seth(0)
tl.fd(-12)
tl.pd()
tl.seth(-115)
tl.circle(235,42)
tl.up()
tl.seth(100)
tl.circle(-220,22)
tl.pd()
tl.pensize(2)
tl.circle(-220,23)
tl.seth(-100)
tl.fillcolor("white")
tl.begin_fill()
tl.circle(260,40)
tl.seth(130)
tl.circle(-235,36)
tl.end_fill()
tl.pensize(3)
tl.seth(90)
tl.circle(-200,32)
tl.seth(-90)
tl.circle(105,45)
tl.seth(-26)
tl.fd(80)
tl.seth(97)
tl.fd(105)
tl.seth(-33)
tl.fd(135)
tl.fillcolor("white")
tl.begin_fill()
tl.up()
tl.fd(35)
tl.seth(-65)
tl.pd()
tl.circle(-225,70)
tl.seth(55)
tl.circle(225,33)
tl.end_fill()
tl.circle(155,20)
tl.fillcolor("white")
tl.begin_fill()
tl.circle(155,43)
tl.seth(-75)
tl.circle(400,14.5)
tl.end_fill()
tl.fillcolor("white")
tl.begin_fill()
tl.circle(400,8.5)
tl.circle(-450,15)
tl.seth(170)
tl.circle(-510,18)
tl.circle(-260,50)
tl.end_fill()
tl.seth(-65)
tl.circle(279,45)
tl.fd(38)
tl.seth(130)
tl.fd(210)
tl.seth(-26)
tl.fd(79)
tl.seth(101)
tl.fd(107)
tl.seth(-26)
tl.fd(123)
tl.up()
tl.seth(0)
tl.fd(10)
tl.pd()
tl.seth(-65)
tl.fillcolor("white")
tl.begin_fill()
tl.circle(170,48)
tl.seth(150)
tl.circle(-150,35)
tl.end_fill()
tl.seth(130)
tl.fd(25)
tl.fd(-25)
tl.seth(-50)
tl.fillcolor("white")
tl.begin_fill()
tl.circle(178,49)
tl.fd(40)
tl.seth(170)
tl.circle(-160,50)
tl.end_fill()
tl.seth(-40)
tl.circle(180,25)
tl.seth(140)
tl.up()
tl.circle(180,25)
tl.pd()
tl.seth(140)
tl.circle(-180,15)
tl.seth(-5)
tl.fillcolor("white")
tl.begin_fill()
tl.circle(-230,60)
tl.seth(100)
tl.circle(240,28)
tl.end_fill()
tl.seth(-50)
tl.circle(160,50)
tl.seth(167)
tl.circle(-188,50)
tl.seth(-17)
tl.circle(-170,60)
tl.seth(97)
tl.circle(500,10)
tl.seth(-52)
tl.circle(-520,12)
tl.up()
tl.seth(75)
tl.fd(180)
tl.pd()
tl.fd(-45)
tl.seth(150)
tl.fd(80)
tl.seth(-85)
tl.fd(30)
tl.seth(170)
tl.fd(180)
tl.seth(-17)
tl.fd(220)
tl.seth(95)
tl.fd(30)
tl.seth(-30)
tl.fd(85)
tl.seth(86)
tl.fd(80)
tl.up()
tl.goto(-118,-158)
tl.seth(-116)
tl.pd()
tl.circle(100,30)
tl.fd(190)
tl.up()
tl.goto(-130,-150)
tl.pd()
tl.seth(-120)
tl.fd(210)
tl.seth(-26)
tl.circle(-140,23)
tl.seth(-170)
tl.fd(20)
tl.left(90)
tl.fd(30)
tl.fd(-30)
tl.left(90)
tl.fd(60)
tl.seth(60)
tl.fd(50)
tl.seth(-3)
tl.fd(60)
tl.seth(42)
tl.fd(51)
tl.fd(-51)
tl.fillcolor("white")
tl.begin_fill()
tl.seth(-3)
tl.fd(-60)
tl.seth(67)
tl.fd(60)
tl.end_fill()
tl.seth(127)
tl.fd(-10)
tl.fillcolor("white")
tl.begin_fill()
tl.fd(68)
tl.seth(4)
tl.fd(70)
tl.end_fill()
tl.seth(-40)
tl.fd(55)
tl.seth(60)
tl.fd(30)
tl.seth(-3)
tl.fd(30)
tl.fd(-30)
tl.seth(60)
tl.fd(-30)
tl.seth(-120)
tl.circle(50,80)
tl.seth(-3)
tl.fd(30)
tl.fd(-30)
tl.seth(-90)
tl.fd(90)
tl.fd(-25)
tl.seth(135)
tl.fd(42)
tl.up()
tl.goto(-130,-150)
tl.pd()
tl.seth(-120)
tl.fd(60)
tl.seth(190)
tl.fd(200)
tl.seth(-120)
tl.fd(140)
tl.seth(-75)
tl.fd(35)
tl.up()
tl.seth(0)
tl.fd(100)
tl.seth(120)
tl.pd()
tl.circle(-125,57)
tl.up()
tl.goto(118,-158)
tl.seth(-64)
tl.pd()
tl.circle(-100,30)
tl.fd(190)
tl.up()
tl.goto(130,-150)
tl.pd()
tl.seth(-60)
tl.fd(210)
tl.seth(206)
tl.circle(140,23)
tl.seth(-10)
tl.fd(20)
tl.right(90)
tl.fd(30)
tl.fd(-30)
tl.right(90)
tl.fd(60)
tl.seth(120)
tl.fd(50)
tl.seth(183)
tl.fd(60)
tl.seth(138)
tl.fd(51)
tl.fd(-51)
tl.fillcolor("white")
tl.begin_fill()
tl.seth(183)
tl.fd(-60)
tl.seth(113)
tl.fd(60)
tl.end_fill()
tl.seth(53)
tl.fd(-10)
tl.fillcolor("white")
tl.begin_fill()
tl.fd(68)
tl.seth(176)
tl.fd(70)
tl.end_fill()
tl.seth(220)
tl.fd(55)
tl.seth(120)
tl.fd(30)
tl.seth(120)
tl.fd(-30)
tl.seth(-60)
tl.circle(-50,80)
tl.seth(183)
tl.fd(30)
tl.fd(-30)
tl.seth(-90)
tl.fd(90)
tl.fd(-35)
tl.seth(45)
tl.fd(42)
tl.up()
tl.goto(130,-150)
tl.pd()
tl.seth(-60)
tl.fd(60)
tl.seth(-10)
tl.fd(200)
tl.seth(-60)
tl.fd(140)
tl.seth(255)
tl.fd(35)
tl.up()
tl.seth(180)
tl.fd(100)
tl.seth(60)
tl.pd()
tl.circle(125,57)
tl.up()
tl.goto(0,-205)
tl.pd()
tl.seth(182)
tl.circle(-142,50)
tl.up()
tl.goto(0,-205)
tl.pd()
tl.seth(-2)
tl.circle(142,50)
tl.up()
tl.seth(0)
tl.fd(250)
tl.pd()
tl.color("red")
tl.write("\n   小朋友\n   生日快乐!\n \n",font=("楷体",23,"normal"))
tl.color("brown")
tl.write("  🎂🎂🎂",font=("楷体",40,"normal"))
time.sleep(2.5)
tl.hideturtle()
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐