python画哆啦A梦python画哆啦A梦
结果如下图:python代码画图案
源代码如下:
# -*- coding: UTF-8 -*-
# 哆啦A梦
import turtle
def flyTo(x, y):
turtle.penup()
<(x, y)
turtle.pendown()
def drawEye():
a = 2.5
for i in range(120):
else:
a += 0.05
turtle.left(3)
turtle.fd(a)
def beard():
""" 画胡⼦,⼀共六根
"""
# 左边第⼀根胡⼦
flyTo(-37, 135)
turtle.seth(165)
turtle.fd(60)
# 左边第⼆根胡⼦
flyTo(-37, 125)
turtle.seth(180)
turtle.fd(60)
# 左边第三根胡⼦
flyTo(-37, 115)
turtle.seth(193)
turtle.fd(60)
# 右边第⼀根胡⼦
flyTo(37, 135)
turtle.seth(15)
turtle.fd(60)
# 右边第⼆根胡⼦
flyTo(37, 125)
turtle.seth(0)
turtle.fd(60)
# 右边第三根胡⼦
flyTo(37, 115)
turtle.seth(-13)getcolumn什么意思
turtle.fd(60)
def drawRedScarf():
""" 画围⼱
"""
turtle.fillcolor("red")  # 填充颜⾊    turtle.begin_fill()
turtle.seth(0)  # 朝向右
turtle.fd(200)  # 前进10个单位    turtle.circle(-5, 90)
turtle.fd(10)
turtle.circle(-5, 90)
turtle.fd(207)
turtle.circle(-5, 90)
turtle.fd(10)
turtle.circle(-5, 90)
turtle.seth(270)
turtle.fd(100)
turtle.seth(0)
turtle.circle(120, 50)
turtle.seth(230)
turtle.circle(-120, 100)
def drawRedNose():
flyTo(-10, 158)
turtle.fillcolor("red")  # 填充颜⾊
turtle.begin_fill()
turtle.circle(20)
def drawBlackdrawEye():
turtle.seth(0)
flyTo(-20, 195)
turtle.fillcolor("#000000")  # 填充颜⾊    turtle.begin_fill()
turtle.circle(13)
turtle.pensize(6)
flyTo(20, 205)
turtle.seth(75)
turtle.circle(-10, 150)
turtle.pensize(3)
flyTo(-17, 200)
turtle.seth(0)
turtle.fillcolor("#ffffff")
turtle.begin_fill()
turtle.circle(5)
flyTo(0, 0)
def drawFace():
"""
csdn百度登录"""
turtle.forward(183)  # 前⾏183个单位    turtle.fillcolor("white")  # 填充颜⾊为⽩⾊    turtle.begin_fill()  # 开始填充
turtle.left(45)  # 左转45度
turtle.circle(120, 100)  # 右边那半边脸    turtle.seth(90)  # 朝向向上
drawEye()  # 画右眼睛
turtle.seth(180)  # 朝向左
turtle.penup()  # 抬笔
turtle.fd(60)  # 前⾏60
turtle.pendown()  # 落笔
turtle.seth(90)  # 朝向上
drawEye()  # 画左眼睛
turtle.penup()  # 抬笔
turtle.seth(180)  # 朝向左
turtle.fd(64)  # 前进64
turtle.pendown()  # 落笔
turtle.seth(215)  # 修改朝向
turtle.circle(120, 100)  # 左边那半边脸    d_fill()  #
on display
def drawHead():
turtle.penup()  # 抬笔
turtle.circle(150, 40)  # 画圆, 半径150,圆周⾓40    turtle.pendown()  # 落笔
turtle.fillcolor("#00a0de")  # 填充⾊
turtle.begin_fill()  # 开始填充
turtle.circle(150, 280)  # 画圆,半径150, 圆周⾓280    d_fill()
def drawAll():
drawHead()
drawRedScarf()
drawFace()
drawRedNose()
drawMouse()
beard()
js字符串转数字规则tonumber
flyTo(0, 0)
turtle.seth(0)
turtle.penup()
turtle.circle(150, 50)
turtle.pendown()
turtle.seth(30)
turtle.fd(40)
turtle.seth(70)
turtle.circle(-30, 270)
turtle.fillcolor("#00a0de")
turtle.begin_fill()
turtle.seth(230)
turtle.fd(80)
turtle.seth(90)
turtle.circle(1000, 1)
turtle.seth(-89)
turtle.circle(-1000, 10)
turtle.seth(180)
turtle.fd(70)
turtle.seth(90)
turtle.circle(30, 180)
turtle.seth(180)
turtle.fd(70)
turtle.seth(100)
turtle.circle(-1000, 9)
turtle.seth(-86)
turtle.circle(1000, 2)
turtle.seth(230)
turtle.fd(40)
turtle.circle(-30, 230)
turtle.seth(45)
turtle.fd(81)
turtle.seth(0)
turtle.fd(203)
turtle.circle(5, 90)
turtle.fd(10)
turtle.circle(5, 90)
turtle.fd(7)
turtle.seth(40)
turtle.circle(150, 10)
turtle.seth(30)
turtle.fd(40)
# 左⼿
turtle.seth(70)
turtle.fillcolor("#FFFFFF")
# 脚
flyTo(103.74, -182.59)
turtle.seth(0)
turtle.fillcolor("#FFFFFF")    turtle.begin_fill()
turtle.fd(15)
turtle.circle(-15, 180)
turtle.fd(90)
turtle.circle(-15, 180)
turtle.fd(10)
flyTo(-96.26, -182.59)
turtle.seth(180)
turtle.fillcolor("#FFFFFF")    turtle.begin_fill()
turtle.fd(15)
turtle.circle(15, 180)
turtle.fd(90)
turtle.circle(15, 180)
turtle.fd(10)
# 右⼿
flyTo(-133.97, -91.81)
turtle.seth(50)
turtle.fillcolor("#FFFFFF")    turtle.begin_fill()
turtle.circle(30)
# ⼝袋
flyTo(-103.42, 15.09)
turtle.seth(0)
turtle.fd(38)
turtle.seth(230)
turtle.begin_fill()
turtle.circle(90, 260)
flyTo(5, -40)
turtle.seth(0)
turtle.fd(70)
turtle.seth(-90)
贵阳it培训学校turtle.circle(-70, 180)
turtle.seth(0)
turtle.fd(70)
# 铃铛
flyTo(-103.42, 15.09)
turtle.fd(90)
turtle.seth(70)
turtle.fillcolor("#ffd200")    turtle.begin_fill()
turtle.circle(-20)
turtle.seth(170)
turtle.fillcolor("#ffd200")    turtle.begin_fill()
turtle.circle(-2, 180)
turtle.seth(10)
turtle.circle(-100, 22)
turtle.circle(-2, 180)

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。