基于Python-turtle库绘制哆啦A梦和大雄在一起

本文通过Python的turtle库详细展示了如何编程绘制哆啦A梦和大雄的形象,包括完整的源码及绘制完成后的效果图。
摘要由CSDN通过智能技术生成

源码:

# -*- coding: utf-8 -*- 

from turtle import *
import turtle

speed(0)
penup()
seth(180)
fd(200)
seth(0)
penup()  #外圈头
circle(150, 40)
pendown()
fillcolor('dodgerblue')
begin_fill()
circle(150, 280)
end_fill()  #外圈头
fillcolor("red")
begin_fill()  #外圈头
seth(0)           #项圈
fd(200)
circle(-5,90)
fd(10)
circle(-5,90)
fd(210)
circle(-5,90)
fd(10)
circle(-5,90)
end_fill()     #项圈
fd(183)   #右脸
left(45)
fillcolor("white")
begin_fill()
circle(120,100)
seth(90)  #眼睛
a = 2.5
for i in range(120):
   if 0 <= i < 30 or 60 <= i < 90:
        a -= 0.05
        lt(3)
        fd(a)
   else:
        a += 0.05
        lt(3)
        fd(a)  
penup()
seth(180)
fd(60)
pendown()
seth(90)
for i in range(120):
   if 0 <= i < 30 or 60 <= i < 90:
        a -= 0.05
        lt(3)
        fd(a)
   else:
        a += 0.05
        lt(3)
        fd(a)  #眼睛
seth(180)
penup()
fd(60)
pendown()
seth(215)
circle(120,100)
end_fill()   #脸部颜色和眼睛部分
seth(0)    # 左眼珠部分
penup()
fd(40)
seth(90)
fd(170)
seth(0)
fd(5)
pendown()
fillcolor("black")
begin_fill()
circle(15,360)
end_fill()
seth(90)
penup()
fd(5)
pendown()
seth(0)
fillcolor("white")
begin_fill()
circle(4,360)
end_fill()     #左眼珠部分
penup()   #右眼珠
seth(0)
fd(58)
seth(270)
fd(15)
seth(0)
pensize(5)
circle(18,90)
pendown()
circle(18,180)
penup()
circle(18,90)
pendown()
pensize(1)#右眼珠
penup()   #鼻子
seth(270)
fd(7)
seth(180)
fd(27)
pendown()
fillcolor("red")
begin_fill()
circle(20)
end_fill()#鼻子
seth(270)#嘴
penup()
fd(40)
pendown()
pencolor("black")
pensize(2)
fd(90)
seth(0)
circle(120,50)
penup()
circle(120,260)
pendown()
circle(120,50)#嘴
penup()     #胡须
seth(90)
fd(60)
seth(0)
fd(20)  
pendown()
fd(60)
penup()
fd(-60)
seth(90)
fd(20)
pendown()
seth(15)
fd(60)
penup()
fd(-60)
seth(270)
fd(40)
pendown()
seth(-15)
fd(50)
penup()
fd(-50)
seth(180)
fd(40)
pendown()
seth(-165)
fd(50)
penup()
fd(-50)
seth(90)
fd(40)
seth(165)
pendown()
fd(60)
fd(-60)
penup()
seth(280)
fd(20)
seth(180)
pendown()
fd(60)        #胡须
penup()  #下半身
home()
penup()
seth(180)
fd(200)
seth(0)
seth(90)
fd(36)
seth(0)
fd(98)
pendown()
fillcolor("dodgerblue")
begin_fill()
seth(50)
fd(70)
seth(40)
fd(20)
right(90)
fd(35)
right(75)
fd(105)
seth(90)
fd(10)
seth(-90)
fd(90)
seth(-95)
fd(80)
seth(
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

BugMiaowu2021

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值