用Python画哆啦A梦

简介: 用Python语言进行编码,画哆啦A梦。

用Python语言进行编码,画哆啦A梦。

import turtle

turtle.speed(5)
turtle.circle(50)
turtle.begin_fill() #画头
turtle.circle(85)
turtle.fillcolor("blue")
turtle.end_fill()

turtle.penup()

turtle.goto(0,20)

turtle.pendown()

turtle.begin_fill()

turtle.circle(35)

turtle.fillcolor("white")

turtle.end_fill()

turtle.begin_fill() #画脸
turtle.circle(60)
turtle.fillcolor("white")
turtle.end_fill()

turtle.penup()
turtle.goto(-20,95) #化左眼眶
turtle.pendown()
turtle.begin_fill()
turtle.circle(19)
turtle.fillcolor("white")
turtle.end_fill()

turtle.penup() #画右眼眶
turtle.goto(20,95)
turtle.pendown()
turtle.begin_fill()
turtle.circle(19)
turtle.fillcolor("white")
turtle.end_fill()

turtle.penup() #化左眼珠
turtle.goto(-8,111)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("black")
turtle.circle(3)
turtle.end_fill()

turtle.penup() #画右眼珠
turtle.goto(8,111)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("black")
turtle.circle(3)
turtle.end_fill()

turtle.penup() #画鼻子
turtle.goto(0,85)
turtle.pendown()
turtle.begin_fill()
turtle.circle(10)
turtle.fillcolor("red")
turtle.end_fill()

turtle.goto(0,30) #画竖线

turtle.penup() #左边第一根胡子
turtle.goto(-20,70)
turtle.pendown()
turtle.goto(-45,80)

turtle.penup() #左边第二根胡子
turtle.goto(-20,60)
turtle.pendown()
turtle.goto(-47,60)

turtle.penup() #左边第三根胡子
turtle.goto(-20,50)
turtle.pendown()
turtle.goto(-47,40)

turtle.penup() #右边第三根胡子
turtle.goto(20,50)
turtle.pendown()
turtle.goto(47,40)

turtle.penup() #右边第二根胡子
turtle.goto(20,60)
turtle.pendown()
turtle.goto(47,60)

turtle.penup() #左边第一根胡子
turtle.goto(20,70)
turtle.pendown()
turtle.goto(45,80)

turtle.penup() #右边胳膊1
turtle.goto(50,20)
turtle.pendown()
turtle.goto(100,-10)

turtle.penup() #右边胳膊2
turtle.goto(50,-20)
turtle.pendown()
turtle.goto(80,-40)

turtle.begin_fill()
turtle.goto(100,-10)
turtle.goto(50,20)
turtle.goto(50,-20)
turtle.goto(80,-40)
turtle.fillcolor("yellow")
turtle.end_fill()

turtle.penup() #右手
turtle.goto(100,-50)
turtle.pendown()
turtle.begin_fill()
turtle.circle(20)
turtle.fillcolor("blue")
turtle.end_fill()

turtle.penup() #左边胳膊1
turtle.goto(-50,20)
turtle.pendown()
turtle.goto(-100,-10)

turtle.penup() #左边胳膊2
turtle.goto(-50,-20)
turtle.pendown()
turtle.goto(-80,-40)

turtle.begin_fill()
turtle.goto(-100,-10)
turtle.goto(-50,20)
turtle.goto(-50,-20)
turtle.goto(-80,-40)
turtle.fillcolor("yellow")
turtle.end_fill()

turtle.penup() #左手
turtle.goto(-100,-53)
turtle.pendown()
turtle.begin_fill()
turtle.circle(20)
turtle.fillcolor("blue")
turtle.end_fill()

turtle.penup() #左手
turtle.goto(-50,-20)
turtle.pendown()
turtle.goto(-50,-100)

turtle.penup() #左手
turtle.goto(50,-20)
turtle.pendown()
turtle.goto(50,-100)

turtle.begin_fill()
turtle.penup()
turtle.goto(50,-120)
turtle.pendown()
turtle.circle(10)
turtle.fillcolor("blue")
turtle.end_fill()

turtle.begin_fill()
turtle.goto(20,-120)
turtle.circle(10)
turtle.fillcolor("blue")
turtle.end_fill()

turtle.penup()
turtle.goto(50,-100)
turtle.pendown()
turtle.goto(20,-100)

turtle.penup()
turtle.goto(-50,-120)
turtle.pendown()
turtle.begin_fill()
turtle.circle(10)
turtle.goto(-20,-120)
turtle.circle(10)
turtle.fillcolor("blue")
turtle.end_fill()

turtle.penup()
turtle.goto(-20,-100)
turtle.pendown()
turtle.goto(-50,-100)

turtle.penup()
turtle.goto(-20,-100)
turtle.pendown()
turtle.goto(-20,-85)

turtle.goto(20,-85)
turtle.goto(20,-100)

turtle.penup()
turtle.goto(-50,-20)
turtle.pendown()

turtle.begin_fill()
turtle.goto(50,-20)
turtle.goto(50,-85)
turtle.goto(-50,-85)
turtle.goto(-50,-20)
turtle.fillcolor("blue")
turtle.end_fill()

turtle.penup()
turtle.goto(0,-20) #铃铛
turtle.pendown()
turtle.begin_fill()
turtle.circle(10)
turtle.fillcolor("yellow")
turtle.end_fill()

turtle.penup()
turtle.goto(-10,-10)
turtle.pendown()
turtle.goto(10,-10)

turtle.penup()
turtle.goto(-50,20)
turtle.pendown()
turtle.begin_fill()
turtle.goto(50,20)
turtle.goto(50,0)
turtle.goto(-50,0)
turtle.goto(-50,20)
turtle.fillcolor("red")
turtle.end_fill()

turtle.penup()
turtle.goto(50,0)
turtle.pendown()
turtle.begin_fill()
turtle.circle(10)
turtle.fillcolor("red")
turtle.end_fill()

turtle.penup()
turtle.goto(-50,0)
turtle.pendown()
turtle.begin_fill()
turtle.circle(10)
turtle.fillcolor("red")
turtle.end_fill()

turtle.penup() #内裤
turtle.goto(-50,-70)
turtle.pendown()
turtle.begin_fill()
turtle.goto(50,-70)
turtle.goto(50,-50)
turtle.goto(-50,-50)
turtle.goto(-50,-70)
turtle.fillcolor("red")
turtle.end_fill()

turtle.penup()
turtle.goto(-10,-70)
turtle.pendown()
turtle.begin_fill()
turtle.goto(-10,-85)
turtle.goto(10,-85)
turtle.goto(10,-70)
turtle.goto(-10,-70)
turtle.fillcolor("red")
turtle.end_fill()

turtle.penup()
turtle.goto(-100,200)
turtle.pendown()
s = "升本加油呀"
turtle.write(s,font = ("Arial",30,
"normal"))

turtle.done()

相关文章
|
Python
萌妹子Python入门指北(三)
其中if和else之间可以加多个else if语句,如果代码执行到这一个判断,你们就执行本行后面有相同缩进的代码,负责就跳到下一个else if,或者else。
43 0
|
运维 Linux C++
|
Python 容器
萌妹子Python入门指北(二)
有一天我写了一个很复杂的计算式子得出一个结果,然后我要拿这个结果去和别的数做计算,比如我 (((123*2421+111)/16)+15)*179 然后把得出的结果再来计算一次,难道我要把这个结果记下来然后再输入吗??我们最好有个容器把结果保存下来,接下来我们直接拿来用就可以了,那么在python这个容器叫什么?这里引出本文最后一个专业术语 变量
59 0
|
开发者 Python
【python圣诞树的实现】
【python圣诞树的实现】
156 0
|
6月前
|
Python
Python猪猪侠代码
Python猪猪侠代码
147 3
|
6月前
|
JavaScript 前端开发 Ruby
那些让人惊叹的Python代码
那些让人惊叹的Python代码
28 0
|
程序员 Python
萌妹子Python入门指北(四)
1.if可以嵌套for吗?可以嵌套while循环吗? 2.难道只能嵌套两层吗?3层 4层 5层可不可以? 一般的文章在这个时候会告诉大家『这里我就不公布答案了,大家可以去尝试下』,然而我这里我偏要告诉大家答案很明显都是yes yes,你试不试就和我无关了。
44 0
|
程序员 Python
萌妹子Python入门指北(五)
def isprime(n): //isprime是函数名,n是需要判断的数 for i in range(2, n): if n%i == 0: //这里如果被i整除了看到不是素数了,素数的定义就是因子只有1和它本身 return False return True
44 0
|
7月前
|
机器学习/深度学习 人工智能 数据可视化
Python:探索编程之美
Python:探索编程之美
36 0
|
程序员 Python
Python圣诞树
一年一度的圣诞节又要来喽~在这么浪漫的节日里怎么能少的了一个浪漫的程序员呢~让我们一起画个圣诞树,送给你喜欢的那个人吧~
103 0
Python圣诞树
下一篇
DataWorks