我想一直在你身边直到你不需要我为止——《哆啦a梦》
下面就是Python画哆啦A梦的源代码:
# -*- codeing = utf-8 -*-
# @Time : 2022/10/17 12:09
# @Author : 可乐不加糖
# @File : duolaAmeng.py
# @Software: PyCharm
import turtle #导入turtle库
import time
# 实现清屏
def clear():
turtle.speed(0)
turtle.penup()
turtle.home()
turtle.pensize(800)
turtle.pencolor("white")
turtle.pendown()
turtle.forward(400)
turtle.back(800)
# 先画哆啦A梦的外部轮廓
def duo_head():
turtle.setup(1800, 1800, 0, 0) # 设置窗口大小和位置
turtle.speed(10)
turtle.penup() # 抬起画笔
turtle.goto(0, 100) # 将画笔移到指定位置
turtle.circle(150, 45)
turtle.pensize(1)
turtle.pencolor("black")
turtle.pendown() # 放下画笔
turtle.begin_fill()
turtle.fillcolor("#38B8F7")
turtle.circle(150, 270)
turtle.penup()
turtle.circle(150, 340)
turtle.seth(150)
turtle.pendown()
turtle.forward(30)
turtle.left(80)
turtle.circle(-30)
turtle.penup()
turtle.circle(-30, 60)
turtle.left(130)
turtle.pendown()
turtle.forward(120)
turtle.seth(90)
turtle.circle(-300, 5)
turtle.penup()
turtle.back(20)
turtle.pendown()
turtle.seth(-90)
turtle.circle(800, 8)
turtle.right(60)
turtle.circle(20, 120)
turtle.seth(0)
turtle.forward(110)
turtle.seth(60)
turtle.circle(-20, 120)
turtle.seth(0)
turtle.fd(110)
turtle.seth(40)
turtle.circle(20, 120)
turtle.seth(90)
turtle.circle(700, 10)
turtle.circle(800, 2)
turtle.penup()
turtle.back(30)
turtle.seth(-30)
turtle.pendown()
turtle.forward(5)
turtle.circle(500, 5)
turtle.circle(20, 180)
turtle.forward(80)
turtle.end_fill()
# 画哆啦A梦的手
def duo_hand():
turtle.back(80)
turtle.seth(30)
turtle.circle(-30, 290)
turtle.penup()
turtle.goto(-155, 225)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("white")
turtle.circle(30)
turtle.end_fill()
# 画哆啦A梦的脚
def duo_feet():
turtle.penup()
turtle.goto(-129, -45)
turtle.pendown()
turtle.left(90)
turtle.forward(10)
turtle.circle(15, 150)
turtle.circle(200, 30)
turtle.circle(100, 17)
turtle.circle(15, 130)
turtle.penup()
turtle.goto(25, -50)
turtle.pendown()
turtle.left(50)
turtle.circle(18, 130)
turtle.circle(100, 18)
turtle.circle(200, 25)
turtle.circle(18, 140)
# 画哆啦A梦的脸
def duo_face():
turtle.penup()
turtle.goto(-70, 340)
turtle.pensize(1)
turtle.left(30)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("white")
turtle.circle(50, 80)
turtle.penup()
turtle.goto(-100, 300)
turtle.seth(170)
turtle.pendown()
turtle.circle(30, 220)
turtle.penup()
turtle.circle(30, 310)
turtle.pendown()
turtle.right(70)
turtle.circle(150, 40)
turtle.seth(0)
turtle.forward(170)
turtle.seth(60)
turtle.circle(150, 40)
turtle.penup()
turtle.goto(55, 250)
turtle.seth(-60)
turtle.circle(30, 60)
turtle.pendown()
turtle.circle(30, 230)
turtle.penup()
turtle.circle(30, 280)
turtle.seth(100)
turtle.pendown()
turtle.circle(80, 30)
turtle.circle(50, 40)
turtle.end_fill()
turtle.penup()
turtle.goto(-30, 380)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("white")
turtle.circle(30)
turtle.penup()
turtle.goto(30, 380)
turtle.pendown()
turtle.circle(30)
turtle.end_fill()
turtle.penup()
turtle.goto(10, 360)
turtle.pensize(8)
turtle.pendown()
turtle.circle(8)
turtle.penup()
turtle.goto(-20, 360)
turtle.pensize(8)
turtle.pendown()
turtle.circle(8)
turtle.penup()
turtle.goto(-95, 242)
turtle.seth(10)
turtle.pensize(1)
turtle.pendown()
turtle.circle(500, 5)
turtle.circle(-60, 20)
turtle.circle(200, 10)
turtle.circle(-60, 20)
turtle.circle(500, 5)
turtle.circle(500, 3)
turtle.penup()
turtle.goto(-9, 300)
turtle.pensize(1)
turtle.pendown()
turtle.circle(16)
turtle.seth(-90)
turtle.forward(50)
turtle.penup()
turtle.goto(-35, 300)
turtle.seth(160)
turtle.pendown()
turtle.forward(60)
turtle.penup()
turtle.goto(-35, 290)
turtle.seth(180)
turtle.pendown()
turtle.forward(80)
turtle.penup()
turtle.goto(-35, 280)
turtle.seth(200)
turtle.pendown()
turtle.forward(90)
turtle.penup()
turtle.goto(20, 300)
turtle.seth(20)
turtle.pendown()
turtle.forward(60)
turtle.penup()
turtle.goto(20, 290)
turtle.seth(0)
turtle.pendown()
turtle.forward(80)
turtle.penup()
turtle.goto(20, 280)
turtle.seth(-20)
turtle.pendown()
turtle.forward(90)
turtle.penup()
turtle.goto(-90, 245)
turtle.seth(-70)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("red")
turtle.circle(200, 20)
turtle.seth(-30)
turtle.circle(100, 50)
turtle.seth(40)
turtle.circle(200, 24)
turtle.seth(165)
turtle.circle(500, 10)
turtle.end_fill()
turtle.penup()
turtle.goto(-50, 185)
turtle.seth(90)
turtle.pensize(1)
turtle.pendown()
turtle.circle(-40, 190)
# 画哆啦A梦的肚子
def duo_du():
turtle.penup()
turtle.goto(-50, -10)
turtle.seth(160)
turtle.pensize(1)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("white")
turtle.circle(-80, 110)
turtle.circle(-90, 110)
turtle.circle(-80, 110)
turtle.circle(-110, 55)
turtle.end_fill()
turtle.penup()
turtle.goto(-70, 70)
turtle.seth(-10)
turtle.pensize(1)
turtle.pendown()
for i in range(16):
turtle.fd(4)
turtle.left(0.5)
turtle.seth(10)
for i in range(16):
turtle.fd(4)
turtle.left(0.5)
turtle.right(120)
turtle.circle(-70, 90)
turtle.right(10)
turtle.circle(-70, 50)
# 画哆啦A梦的铃铛
def duo_lingdang():
turtle.penup()
turtle.goto(-115, 150)
turtle.seth(0)
turtle.pensize(1)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("red")
turtle.forward(230)
turtle.right(10)
turtle.circle(-5, 170)
turtle.forward(230)
turtle.circle(-5, 170)
turtle.end_fill()
turtle.penup()
turtle.goto(-20, 140)
turtle.pensize(1)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.left(10)
turtle.circle(-20)
turtle.end_fill()
turtle.penup()
turtle.goto(-30, 130)
turtle.pensize(1)
turtle.seth(0)
turtle.pendown()
turtle.forward(34)
turtle.penup()
turtle.goto(5, 125)
turtle.pensize(1)
turtle.seth(0)
turtle.pendown()
turtle.back(37)
turtle.penup()
turtle.goto(-12, 115)
turtle.pensize(3)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("black")
turtle.circle(4)
turtle.end_fill()
turtle.seth(-90)
turtle.pensize(1)
turtle.forward(15)
# 显示文字
def draw_1():
turtle.setup(1800, 1800, 0, 0)
turtle.penup()
turtle.hideturtle() #隐藏箭头显示
turtle.goto(-250, -250)
turtle.color('black')
write = turtle.write('哆啦A梦', font=('wisdom', 120, 'normal'))
time.sleep(2)
# clear()
duo_head()
duo_hand()
duo_feet()
duo_face()
duo_du()
duo_lingdang()
draw_1()
turtle.hideturtle()
turtle.done()