import turtle as T
import random
import time

# 画樱花的躯干(60,t)
def Tree(branch, t):
    time.sleep(0.0005)
    if branch > 3:
        if 8 <= branch <= 12:
            if random.randint(0, 2) == 0:
                t.color('snow')  # 白
            else:
                t.color('lightcoral')  # 淡珊瑚色
            t.pensize(branch / 3)
        elif branch < 8:
            if random.randint(0, 1) == 0:
                t.color('snow')
            else:
                t.color('lightcoral')  # 淡珊瑚色
            t.pensize(branch / 2)
        else:
            t.color('sienna')  # 赭(zhě)色
            t.pensize(branch / 10)  # 6
        t.forward(branch)
        a = 1.5 * random.random()
        t.right(20 * a)
        b = 1.5 * random.random()
        Tree(branch - 10 * b, t)
        t.left(40 * a)
        Tree(branch - 10 * b, t)
        t.right(20 * a)
        t.up()
        t.backward(branch)
        t.down()

# 掉落的花瓣
def Petal(m, t):
    for i in range(m):
        a = 200 - 400 * random.random()
        b = 10 - 20 * random.random()
        t.up()
        t.forward(b)
        t.left(90)
        t.forward(a)
        t.down()
        t.color('lightcoral')  # 淡珊瑚色
        t.circle(1)
        t.up()
        t.backward(a)
        t.right(90)
        t.backward(b)

# 绘图区域
t = T.Turtle()
# 画布大小
w = T.Screen()
t.hideturtle()  # 隐藏画笔
t.getscreen().tracer(5, 0)
w.screensize(bg='wheat')  # wheat小麦
t.left(90)
t.up()
t.backward(150)
t.down()
t.color('sienna')

# 画樱花的躯干
Tree(60, t)
# 掉落的花瓣
Petal(200, t)
w.exitonclick()

运行效果:

用python画logo 用python画枫叶_ci

 

from turtle import *
from random import *
from math import *

def tree(n,l):
    pd()#下笔
    #阴影效果
    t = cos(radians(heading()+45))/8+0.25
    pencolor(t,t,t)
    pensize(n/3)
    forward(l)#画树枝

    if n>0:
        b = random()*15+10 #右分支偏转角度
        c = random()*15+10 #左分支偏转角度
        d = l*(random()*0.25+0.7) #下一个分支的长度
        #右转一定角度,画右分支
        right(b)
        tree(n-1,d)
        #左转一定角度,画左分支
        left(b+c)
        tree(n-1,d)
        #转回来
        right(c)
    else:
        #画叶子
        right(90)
        n=cos(radians(heading()-45))/4+0.5
        pencolor(n,n*0.8,n*0.8)
        circle(3)
        left(90)
        #添加0.3倍的飘落叶子
        if(random()>0.7):
            pu()
            #飘落
            t = heading()
            an = -40 +random()*40
            setheading(an)
            dis = int(800*random()*0.5 + 400*random()*0.3 + 200*random()*0.2)
            forward(dis)
            setheading(t)
            #画叶子
            pd()
            right(90)
            n = cos(radians(heading()-45))/4+0.5
            pencolor(n*0.5+0.5,0.4+n*0.4,0.4+n*0.4)
            circle(2)
            left(90)
            pu()
            #返回
            t=heading()
            setheading(an)
            backward(dis)
            setheading(t)
    pu()
    backward(l)#退回

bgcolor(0.5,0.5,0.5)#背景色
ht()#隐藏turtle
speed(0)#速度 1-10渐进,0 最快
tracer(0,0)
pu()#抬笔
backward(100)
left(90)#左转90度
pu()#抬笔
backward(300)#后退300
tree(12,100)#递归7层
done()

运行效果:

用python画logo 用python画枫叶_用python画logo_02

 

from turtle import *
from random import *
from math import *

def tree(n, l):
    pd()
    t = cos(radians(heading() + 45)) / 8 + 0.25
    pencolor(t, t, t)
    pensize(n / 4)
    forward(l)
    if n > 0:
        b = random() * 15 + 10
        c = random() * 15 + 10
        d = l * (random() * 0.35 + 0.6)
        right(b)
        tree(n - 1, d)
        left(b + c)
        tree(n - 1, d)
        right(c)
    else:
        right(90)
        n = cos(radians(heading() - 45)) / 4 + 0.5
        pencolor(n, n, n)
        circle(2)
        left(90)
    pu()
    backward(l)
bgcolor(0.5, 0.5, 0.5)
ht()
speed(0)
tracer(0, 0)
left(90)
pu()
backward(300)
tree(13, 100)
done()

运行效果:

用python画logo 用python画枫叶_用python画logo_03

 

from turtle import *
import time
ht()
pensize(3)

setup(1000,800,0,0)
speed(0)
penup()
seth(90)
fd(340)
seth(0)
pendown()

speed(5)
begin_fill()
fillcolor('red')
circle(50,30)

for i in range(10):
    fd(1)
    left(10)

circle(40,40)

for i in range(6):
    fd(1)
    left(3)

circle(80,40)

for i in range(20):
    fd(0.5)
    left(5)

circle(80,45)

for i in range(10):
    fd(2)
    left(1)

circle(80,25)

for i in range(20):
    fd(1)
    left(4)

circle(50,50)

time.sleep(0.1)

circle(120,55)

speed(0)

seth(-90)
fd(70)

right(150)
fd(20)

left(140)
circle(140,90)

left(30)
circle(160,100)

left(130)
fd(25)

penup()
right(150)
circle(40,80)
pendown()

left(115)
fd(60)

penup()
left(180)
fd(60)
pendown()

end_fill()

right(120)
circle(-50,50)
circle(-20,90)

speed(1)
fd(75)

speed(0)
circle(90,110)

penup()
left(162)
fd(185)
left(170)
pendown()
circle(200,10)
circle(100,40)
circle(-52,115)
left(20)
circle(100,20)
circle(300,20)
speed(1)
fd(250)

penup()
speed(0)
left(180)
fd(250)
circle(-300,7)
right(80)
circle(200,5)
pendown()

left(60)
begin_fill()
fillcolor('green')
circle(-80,100)
right(90)
fd(10)
left(20)
circle(-63,127)
end_fill()

penup()
left(50)
fd(20)
left(180)

pendown()
circle(200,25)

penup()
right(150)

fd(180)

right(40)
pendown()
begin_fill()
fillcolor('green')
circle(-100,80)
right(150)
fd(10)
left(60)
circle(-80,98)
end_fill()

penup()
left(60)
fd(13)
left(180)

pendown()
speed(1)
circle(-200,23)

exitonclick()

运行效果:

用python画logo 用python画枫叶_背景色_04

 

from turtle import *
import random
import time

n = 100.0

speed("fastest")
screensize(bg='seashell')
left(90)
forward(3*n)
color("orange", "yellow")
begin_fill()
left(126)

for i in range(5):
    forward(n/5)
    right(144)
    forward(n/5)
    left(72)
end_fill()
right(126)

color("dark green")
backward(n*4.8)
def tree(d, s):
    if d <= 0: return
    forward(s)
    tree(d-1, s*.8)
    right(120)
    tree(d-3, s*.5)
    right(120)
    tree(d-3, s*.5)
    right(120)
    backward(s)
tree(15, n)
backward(n/2)

for i in range(200):
    a = 200 - 400 * random.random()
    b = 10 - 20 * random.random()
    up()
    forward(b)
    left(90)
    forward(a)
    down()
    if random.randint(0, 1) == 0:
            color('tomato')
    else:
        color('wheat')
    circle(2)
    up()
    backward(a)
    right(90)
    backward(b)

time.sleep(60)

运行效果:

用python画logo 用python画枫叶_背景色_05

 

import turtle as t
t.pensize(4) # 设置画笔的大小
t.colormode(255) # 设置GBK颜色范围为0-255
t.color((255,155,192),"pink") # 设置画笔颜色和填充颜色(pink)
t.setup(840,500) # 设置主窗口的大小为840*500
t.speed(10) # 设置画笔速度为10
#鼻子
t.pu() # 提笔
t.goto(-100,100) # 画笔前往坐标(-100,100)
t.pd() # 下笔
t.seth(-30) # 笔的角度为-30°
t.begin_fill() # 外形填充的开始标志
a=0.4
for i in range(120):
   if 0<=i<30 or 60<=i<90:
       a=a+0.08
       t.lt(3) #向左转3度
       t.fd(a) #向前走a的步长
   else:
       a=a-0.08
       t.lt(3)
       t.fd(a)
t.end_fill() # 依据轮廓填充
t.pu() # 提笔
t.seth(90) # 笔的角度为90度
t.fd(25) # 向前移动25
t.seth(0) # 转换画笔的角度为0
t.fd(10)
t.pd()
t.pencolor(255,155,192) # 设置画笔颜色
t.seth(10)
t.begin_fill()
t.circle(5) # 画一个半径为5的圆
t.color(160,82,45) # 设置画笔和填充颜色
t.end_fill()
t.pu()
t.seth(0)
t.fd(20)
t.pd()
t.pencolor(255,155,192)
t.seth(10)
t.begin_fill()
t.circle(5)
t.color(160,82,45)
t.end_fill()
#头
t.color((255,155,192),"pink")
t.pu()
t.seth(90)
t.fd(41)
t.seth(0)
t.fd(0)
t.pd()
t.begin_fill()
t.seth(180)
t.circle(300,-30) # 顺时针画一个半径为300,圆心角为30°的园
t.circle(100,-60)
t.circle(80,-100)
t.circle(150,-20)
t.circle(60,-95)
t.seth(161)
t.circle(-300,15)
t.pu()
t.goto(-100,100)
t.pd()
t.seth(-30)
a=0.4
for i in range(60):
   if 0<=i<30 or 60<=i<90:
       a=a+0.08
       t.lt(3) #向左转3度
       t.fd(a) #向前走a的步长
   else:
       a=a-0.08
       t.lt(3)
       t.fd(a)
t.end_fill()
#耳朵
t.color((255,155,192),"pink")
t.pu()
t.seth(90)
t.fd(-7)
t.seth(0)
t.fd(70)
t.pd()
t.begin_fill()
t.seth(100)
t.circle(-50,50)
t.circle(-10,120)
t.circle(-50,54)
t.end_fill()
t.pu()
t.seth(90)
t.fd(-12)
t.seth(0)
t.fd(30)
t.pd()
t.begin_fill()
t.seth(100)
t.circle(-50,50)
t.circle(-10,120)
t.circle(-50,56)
t.end_fill()
#眼睛
t.color((255,155,192),"white")
t.pu()
t.seth(90)
t.fd(-20)
t.seth(0)
t.fd(-95)
t.pd()
t.begin_fill()
t.circle(15)
t.end_fill()
t.color("black")
t.pu()
t.seth(90)
t.fd(12)
t.seth(0)
t.fd(-3)
t.pd()
t.begin_fill()
t.circle(3)
t.end_fill()
t.color((255,155,192),"white")
t.pu()
t.seth(90)
t.fd(-25)
t.seth(0)
t.fd(40)
t.pd()
t.begin_fill()
t.circle(15)
t.end_fill()
t.color("black")
t.pu()
t.seth(90)
t.fd(12)
t.seth(0)
t.fd(-3)
t.pd()
t.begin_fill()
t.circle(3)
t.end_fill()
#腮
t.color((255,155,192))
t.pu()
t.seth(90)
t.fd(-95)
t.seth(0)
t.fd(65)
t.pd()
t.begin_fill()
t.circle(30)
t.end_fill()
#嘴
t.color(239,69,19)
t.pu()
t.seth(90)
t.fd(15)
t.seth(0)
t.fd(-100)
t.pd()
t.seth(-80)
t.circle(30,40)
t.circle(40,80)
#身体
t.color("red",(255,99,71))
t.pu()
t.seth(90)
t.fd(-20)
t.seth(0)
t.fd(-78)
t.pd()
t.begin_fill()
t.seth(-130)
t.circle(100,10)
t.circle(300,30)
t.seth(0)
t.fd(230)
t.seth(90)
t.circle(300,30)
t.circle(100,3)
t.color((255,155,192),(255,100,100))
t.seth(-135)
t.circle(-80,63)
t.circle(-150,24)
t.end_fill()
#手
t.color((255,155,192))
t.pu()
t.seth(90)
t.fd(-40)
t.seth(0)
t.fd(-27)
t.pd()
t.seth(-160)
t.circle(300,15)
t.pu()
t.seth(90)
t.fd(15)
t.seth(0)
t.fd(0)
t.pd()
t.seth(-10)
t.circle(-20,90)
t.pu()
t.seth(90)
t.fd(30)
t.seth(0)
t.fd(237)
t.pd()
t.seth(-20)
t.circle(-300,15)
t.pu()
t.seth(90)
t.fd(20)
t.seth(0)
t.fd(0)
t.pd()
t.seth(-170)
t.circle(20,90)
#脚
t.pensize(10)
t.color((240,128,128))
t.pu()
t.seth(90)
t.fd(-75)
t.seth(0)
t.fd(-180)
t.pd()
t.seth(-90)
t.fd(40)
t.seth(-180)
t.color("black")
t.pensize(15)
t.fd(20)
t.pensize(10)
t.color((240,128,128))
t.pu()
t.seth(90)
t.fd(40)
t.seth(0)
t.fd(90)
t.pd()
t.seth(-90)
t.fd(40)
t.seth(-180)
t.color("black")
t.pensize(15)
t.fd(20)
#尾巴
t.pensize(4)
t.color((255,155,192))
t.pu()
t.seth(90)
t.fd(70)
t.seth(0)
t.fd(95)
t.pd()
t.seth(0)
t.circle(70,20)
t.circle(10,330)
t.circle(70,30)

运行效果:

用python画logo 用python画枫叶_背景色_06

 

from turtle import *
'''
绘制皮卡丘头部
'''
def face(x,y):
    """画脸"""
    begin_fill()
    penup()
    # 将海龟移动到指定的坐标
    goto(x, y)
    pendown()
    # 设置海龟的方向
    setheading(40)

    circle(-150, 69)
    fillcolor("#FBD624")
    # 将海龟移动到指定的坐标
    
    penup()
    goto(53.14, 113.29)
    pendown()
    
    setheading(300)
    circle(-150, 30)
    setheading(295)
    circle(-140, 20)
    print(position())
    forward(5)
    setheading(260)
    circle(-80, 70)
    print(position())
    penup()
    goto(-74.43,-79.09)
    pendown()


    penup()
    # 将海龟移动到指定的坐标
    goto(-144,103)
    pendown()
    setheading(242)
    circle(110, 35)
    right(10)
    forward(10)
    setheading(250)
    circle(80, 115)
    print(position())

    penup()
    goto(-74.43,-79.09)
    pendown()
    setheading(10)
    penup()
    goto(-144, 103)

    pendown()
    penup()
    goto(x, y)
    pendown()


    end_fill()

    # 下巴
    penup()
    goto(-50, -82.09)
    pendown()
    pencolor("#DDA120")
    fillcolor("#DDA120")
    begin_fill()
    setheading(-12)
    circle(120, 25)
    setheading(-145)
    forward(30)
    setheading(180)
    circle(-20, 20)
    setheading(143)
    forward(30)
    end_fill()
    # penup()
    # # 将海龟移动到指定的坐标
    # goto(0, 0)
    # pendown()

def eye():
    """画眼睛"""
    # 左眼
    color("black","black")
    penup()
    goto(-110, 27)
    pendown()
    begin_fill()
    setheading(0)
    circle(24)
    end_fill()
    # 左眼仁
    color("white", "white")
    penup()
    goto(-105, 51)
    pendown()
    begin_fill()
    setheading(0)
    circle(10)
    end_fill()
    # 右眼
    color("black", "black")
    penup()
    goto(25, 40)
    pendown()
    begin_fill()
    setheading(0)
    circle(24)
    end_fill()
    # 右眼仁
    color("white", "white")
    penup()
    goto(17, 62)
    pendown()
    begin_fill()
    setheading(0)
    circle(10)
    end_fill()
def cheek():
    """画脸颊"""
    # 右边
    color("#9E4406", "#FE2C21")
    penup()
    goto(-130, -50)
    pendown()
    begin_fill()
    setheading(0)
    circle(27)
    end_fill()

    # 左边
    color("#9E4406", "#FE2C21")
    penup()
    goto(53, -20)
    pendown()
    begin_fill()
    setheading(0)
    circle(27)
    end_fill()


def nose():
    """画鼻子"""
    color("black", "black")
    penup()
    goto(-40, 38)
    pendown()
    begin_fill()
    circle(7,steps = 3)
    end_fill()
def mouth():
    """画嘴"""
    color("black", "#F35590")
    # 嘴唇
    penup()
    goto(-10, 22)
    pendown()
    begin_fill()
    setheading(260)
    forward(60)
    circle(-11, 150)
    forward(55)
    print(position())
    penup()
    goto(-38.46, 21.97)
    pendown()
    end_fill()

    # 舌头
    color("#6A070D", "#6A070D")
    begin_fill()
    penup()
    goto(-10.00, 22.00)
    pendown()
    penup()
    goto(-14.29, -1.7)
    pendown()
    penup()
    goto(-52, -5)
    pendown()
    penup()
    goto(-60.40, 12.74)
    pendown()
    penup()
    goto(-38.46, 21.97)
    pendown()
    penup()
    goto(-10.00, 22.00)
    pendown()

    end_fill()

    color("black","#FFD624")

    penup()
    goto(-78, 15)
    pendown()
    begin_fill()
    setheading(-25)
    for i in range(2):
        setheading(-25)
        circle(35, 70)

    end_fill()
    color("#AB1945", "#AB1945")
    penup()
    goto(-52, -5)
    pendown()
    begin_fill()
    setheading(40)
    circle(-33, 70)
    goto(-16,-1.7)
    penup()
    goto(-18,-17)
    pendown()
    setheading(155)
    circle(25, 70)
    end_fill()


def ear():
    """画耳朵"""
    # 左耳
    color("black","#FFD624")
    penup()
    goto(-145, 93)
    pendown()
    begin_fill()
    setheading(165)
    circle(-248,50)
    right(120)
    circle(-248,50)
    end_fill()
    color("black", "black")
    penup()
    goto(-240, 143)
    pendown()
    begin_fill()
    setheading(107)
    circle(-170, 25)
    left(80)
    circle(229, 15)
    left(120)
    circle(300, 15)
    end_fill()

    # 右耳
    color("black", "#FFD624")
    penup()
    goto(30, 136)
    pendown()
    begin_fill()
    setheading(64)
    circle(-248, 50)

    right(120)
    circle(-248, 50)
    end_fill()
    color("black", "black")
    penup()
    goto(160, 200)
    pendown()
    begin_fill()
    setheading(52)
    circle(170, 25)
    left(116)
    circle(229, 15)
    left(71)
    circle(-300, 15)
    end_fill()
    def setting():
    """设置参数"""
    pensize(2)
    # 隐藏海龟
    hideturtle()
    speed(10)
def main():
    """主函数"""
    setting()
    face(-132,115)
    eye()
    cheek()
    nose()
    mouth()
    ear()
    done()

if __name__ == '__main__':
    main()

运行效果:

用python画logo 用python画枫叶_ci_07

 

import turtle


def getPosition(x, y):
    turtle.setx(x)
    turtle.sety(y)
    print(x, y)


class Pikachu:

    def __init__(self):
        self.t = turtle.Turtle()
        t = self.t
        t.pensize(3)
        t.speed(9)
        t.ondrag(getPosition)

    def noTrace_goto(self, x, y):
        self.t.penup()
        self.t.goto(x, y)
        self.t.pendown()

    def leftEye(self, x, y):
        self.noTrace_goto(x, y)
        t = self.t
        t.seth(0)
        t.fillcolor('#333333')
        t.begin_fill()
        t.circle(22)
        t.end_fill()

        self.noTrace_goto(x, y + 10)
        t.fillcolor('#000000')
        t.begin_fill()
        t.circle(10)
        t.end_fill()

        self.noTrace_goto(x + 6, y + 22)
        t.fillcolor('#ffffff')
        t.begin_fill()
        t.circle(10)
        t.end_fill()

    def rightEye(self, x, y):
        self.noTrace_goto(x, y)
        t = self.t
        t.seth(0)
        t.fillcolor('#333333')
        t.begin_fill()
        t.circle(22)
        t.end_fill()

        self.noTrace_goto(x, y + 10)
        t.fillcolor('#000000')
        t.begin_fill()
        t.circle(10)
        t.end_fill()

        self.noTrace_goto(x - 6, y + 22)
        t.fillcolor('#ffffff')
        t.begin_fill()
        t.circle(10)
        t.end_fill()

    def mouth(self, x, y):
        self.noTrace_goto(x, y)
        t = self.t

        t.fillcolor('#88141D')
        t.begin_fill()
        # 下嘴唇
        l1 = []
        l2 = []
        t.seth(190)
        a = 0.7
        for i in range(28):
            a += 0.1
            t.right(3)
            t.fd(a)
            l1.append(t.position())

        self.noTrace_goto(x, y)

        t.seth(10)
        a = 0.7
        for i in range(28):
            a += 0.1
            t.left(3)
            t.fd(a)
            l2.append(t.position())

        # 上嘴唇

        t.seth(10)
        t.circle(50, 15)
        t.left(180)
        t.circle(-50, 15)

        t.circle(-50, 40)
        t.seth(233)
        t.circle(-50, 55)
        t.left(180)
        t.circle(50, 12.1)
        t.end_fill()

        # 舌头
        self.noTrace_goto(17, 54)
        t.fillcolor('#DD716F')
        t.begin_fill()
        t.seth(145)
        t.circle(40, 86)
        t.penup()
        for pos in reversed(l1[:20]):
            t.goto(pos[0], pos[1] + 1.5)
        for pos in l2[:20]:
            t.goto(pos[0], pos[1] + 1.5)
        t.pendown()
        t.end_fill()

        # 鼻子
        self.noTrace_goto(-17, 94)
        t.seth(8)
        t.fd(4)
        t.back(8)

    # 红脸颊
    def leftCheek(self, x, y):
        turtle.tracer(False)
        t = self.t
        self.noTrace_goto(x, y)
        t.seth(300)
        t.fillcolor('#DD4D28')
        t.begin_fill()
        a = 2.3
        for i in range(120):
            if 0 <= i < 30 or 60 <= i < 90:
                a -= 0.05
                t.lt(3)
                t.fd(a)
            else:
                a += 0.05
                t.lt(3)
                t.fd(a)
        t.end_fill()
        turtle.tracer(True)

    def rightCheek(self, x, y):
        t = self.t
        turtle.tracer(False)
        self.noTrace_goto(x, y)
        t.seth(60)
        t.fillcolor('#DD4D28')
        t.begin_fill()
        a = 2.3
        for i in range(120):
            if 0 <= i < 30 or 60 <= i < 90:
                a -= 0.05
                t.lt(3)
                t.fd(a)
            else:
                a += 0.05
                t.lt(3)
                t.fd(a)
        t.end_fill()
        turtle.tracer(True)

    def colorLeftEar(self, x, y):
        t = self.t
        self.noTrace_goto(x, y)
        t.fillcolor('#000000')
        t.begin_fill()
        t.seth(330)
        t.circle(100, 35)
        t.seth(219)
        t.circle(-300, 19)
        t.seth(110)
        t.circle(-30, 50)
        t.circle(-300, 10)
        t.end_fill()

    def colorRightEar(self, x, y):
        t = self.t
        self.noTrace_goto(x, y)
        t.fillcolor('#000000')
        t.begin_fill()
        t.seth(300)
        t.circle(-100, 30)
        t.seth(35)
        t.circle(300, 15)
        t.circle(30, 50)
        t.seth(190)
        t.circle(300, 17)
        t.end_fill()

    def body(self):
        t = self.t

        t.fillcolor('#F6D02F')
        t.begin_fill()
        # 右脸轮廓
        t.penup()
        t.circle(130, 40)
        t.pendown()
        t.circle(100, 105)
        t.left(180)
        t.circle(-100, 5)

        # 右耳朵
        t.seth(20)
        t.circle(300, 30)
        t.circle(30, 50)
        t.seth(190)
        t.circle(300, 36)

        # 上轮廓
        t.seth(150)
        t.circle(150, 70)

        # 左耳朵
        t.seth(200)
        t.circle(300, 40)
        t.circle(30, 50)
        t.seth(20)
        t.circle(300, 35)
        # print(t.pos())

        # 左脸轮廓
        t.seth(240)
        t.circle(105, 95)
        t.left(180)
        t.circle(-105, 5)

        # 左手
        t.seth(210)
        t.circle(500, 18)
        t.seth(200)
        t.fd(10)
        t.seth(280)
        t.fd(7)
        t.seth(210)
        t.fd(10)
        t.seth(300)
        t.circle(10, 80)
        t.seth(220)
        t.fd(10)
        t.seth(300)
        t.circle(10, 80)
        t.seth(240)
        t.fd(12)
        t.seth(0)
        t.fd(13)
        t.seth(240)
        t.circle(10, 70)
        t.seth(10)
        t.circle(10, 70)
        t.seth(10)
        t.circle(300, 18)

        t.seth(75)
        t.circle(500, 8)
        t.left(180)
        t.circle(-500, 15)
        t.seth(250)
        t.circle(100, 65)

        # 左脚
        t.seth(320)
        t.circle(100, 5)
        t.left(180)
        t.circle(-100, 5)
        t.seth(220)
        t.circle(200, 20)
        t.circle(20, 70)

        t.seth(60)
        t.circle(-100, 20)
        t.left(180)
        t.circle(100, 20)
        t.seth(300)
        t.circle(10, 70)

        t.seth(60)
        t.circle(-100, 20)
        t.left(180)
        t.circle(100, 20)
        t.seth(10)
        t.circle(100, 60)

        # 横向
        t.seth(180)
        t.circle(-100, 10)
        t.left(180)
        t.circle(100, 10)
        t.seth(5)
        t.circle(100, 10)
        t.circle(-100, 40)
        t.circle(100, 35)
        t.left(180)
        t.circle(-100, 10)

        # 右脚
        t.seth(290)
        t.circle(100, 55)
        t.circle(10, 50)

        t.seth(120)
        t.circle(100, 20)
        t.left(180)
        t.circle(-100, 20)

        t.seth(0)
        t.circle(10, 50)

        t.seth(110)
        t.circle(100, 20)
        t.left(180)
        t.circle(-100, 20)

        t.seth(30)
        t.circle(20, 50)

        t.seth(100)
        t.circle(100, 40)

        # 右侧身体轮廓
        t.seth(200)
        t.circle(-100, 5)
        t.left(180)
        t.circle(100, 5)
        t.left(30)
        t.circle(100, 75)
        t.right(15)
        t.circle(-300, 21)
        t.left(180)
        t.circle(300, 3)

        # 右手
        t.seth(43)
        t.circle(200, 60)

        t.right(10)
        t.fd(10)

        t.circle(5, 160)
        t.seth(90)
        t.circle(5, 160)
        t.seth(90)

        t.fd(10)
        t.seth(90)
        t.circle(5, 180)
        t.fd(10)

        t.left(180)
        t.left(20)
        t.fd(10)
        t.circle(5, 170)
        t.fd(10)
        t.seth(240)
        t.circle(50, 30)

        t.end_fill()
        self.noTrace_goto(130, 125)
        t.seth(-20)
        t.fd(5)
        t.circle(-5, 160)
        t.fd(5)

        # 手指纹
        self.noTrace_goto(166, 130)
        t.seth(-90)
        t.fd(3)
        t.circle(-4, 180)
        t.fd(3)
        t.seth(-90)
        t.fd(3)
        t.circle(-4, 180)
        t.fd(3)

        # 尾巴
        self.noTrace_goto(168, 134)
        t.fillcolor('#F6D02F')
        t.begin_fill()
        t.seth(40)
        t.fd(200)
        t.seth(-80)
        t.fd(150)
        t.seth(210)
        t.fd(150)
        t.left(90)
        t.fd(100)
        t.right(95)
        t.fd(100)
        t.left(110)
        t.fd(70)
        t.right(110)
        t.fd(80)
        t.left(110)
        t.fd(30)
        t.right(110)
        t.fd(32)

        t.right(106)
        t.circle(100, 25)
        t.right(15)
        t.circle(-300, 2)
        ##############
        # print(t.pos())
        t.seth(30)
        t.fd(40)
        t.left(100)
        t.fd(70)
        t.right(100)
        t.fd(80)
        t.left(100)
        t.fd(46)
        t.seth(66)
        t.circle(200, 38)
        t.right(10)
        t.fd(10)
        t.end_fill()

        # 尾巴花纹
        t.fillcolor('#923E24')
        self.noTrace_goto(126.82, -156.84)
        t.begin_fill()

        t.seth(30)
        t.fd(40)
        t.left(100)
        t.fd(40)
        t.pencolor('#923e24')
        t.seth(-30)
        t.fd(30)
        t.left(140)
        t.fd(20)
        t.right(150)
        t.fd(20)
        t.left(150)
        t.fd(20)
        t.right(150)
        t.fd(20)
        t.left(130)
        t.fd(18)
        t.pencolor('#000000')
        t.seth(-45)
        t.fd(67)
        t.right(110)
        t.fd(80)
        t.left(110)
        t.fd(30)
        t.right(110)
        t.fd(32)
        t.right(106)
        t.circle(100, 25)
        t.right(15)
        t.circle(-300, 2)
        t.end_fill()

        # 帽子、眼睛、嘴巴、脸颊
        self.cap(-134.07, 147.81)
        self.mouth(-5, 25)
        self.leftCheek(-126, 32)
        self.rightCheek(107, 63)
        self.colorLeftEar(-250, 100)
        self.colorRightEar(140, 270)
        self.leftEye(-85, 90)
        self.rightEye(50, 110)
        t.hideturtle()

    def cap(self, x, y):
        self.noTrace_goto(x, y)
        t = self.t
        t.fillcolor('#CD0000')
        t.begin_fill()
        t.seth(200)
        t.circle(400, 7)
        t.left(180)
        t.circle(-400, 30)
        t.circle(30, 60)
        t.fd(50)
        t.circle(30, 45)
        t.fd(60)
        t.left(5)
        t.circle(30, 70)
        t.right(20)
        t.circle(200, 70)
        t.circle(30, 60)
        t.fd(70)
        # print(t.pos())
        t.right(35)
        t.fd(50)
        t.circle(8, 100)
        t.end_fill()
        self.noTrace_goto(-168.47, 185.52)
        t.seth(36)
        t.circle(-270, 54)
        t.left(180)
        t.circle(270, 27)
        t.circle(-80, 98)

        t.fillcolor('#444444')
        t.begin_fill()
        t.left(180)
        t.circle(80, 197)
        t.left(58)
        t.circle(200, 45)
        t.end_fill()

        self.noTrace_goto(-58, 270)
        t.pencolor('#228B22')
        t.dot(35)

        self.noTrace_goto(-30, 280)
        t.fillcolor('#228B22')
        t.begin_fill()
        t.seth(100)
        t.circle(30, 180)
        t.seth(190)
        t.fd(15)
        t.seth(100)
        t.circle(-45, 180)
        t.right(90)
        t.fd(15)
        t.end_fill()
        t.pencolor('#000000')

    def start(self):
        self.body()


def main():
    print('Painting the Pikachu... ')
    turtle.screensize(800, 600)
    turtle.title('Pikachu')
    pikachu = Pikachu()
    pikachu.start()
    turtle.mainloop()


if __name__ == '__main__':
    main()

运行效果:

用python画logo 用python画枫叶_阴影效果_08

 

from turtle import *

screensize(800, 600, "#fed926")
setup(width=1000, height=1000, startx=50, starty=50)
pensize(5)
pencolor("black")
speed(11)


def leftEar():
    # 海龟方向
    setheading(30)
    penup()
    fillcolor("#1f1515")
    goto(110, 150)
    # 左耳左
    pendown()
    setheading(30)
    left(5)
    circle(-410, 55)
    penup()
    # 左儿右
    goto(170, 100)
    setheading(0)
    pendown()
    right(2)
    circle(500, 39)
    # 左耳颜色
    begin_fill()
    left(124)
    circle(400, 15)
    left(-90)
    circle(200, -27)
    right(42)
    circle(400, 20)
    end_fill()
    penup()


def rightEar():
    # 右耳右
    goto(-120, 180)
    left(10)
    pendown()
    circle(400, 50)
    # 右耳左
    left(118)
    circle(400, 60)
    penup()
    # 右耳颜色
    goto(-75, 450)
    left(-140)
    pendown()
    begin_fill()
    circle(400, -13)
    right(41)
    circle(405, 17)
    left(120)
    circle(400, 10)
    end_fill()
    penup()


def head():
    # 轮廓,上
    goto(-130, 175)
    right(32)
    pendown()
    circle(400, -37)
    # 轮廓,左
    penup()
    goto(181, 99)
    left(125)
    pendown()
    right(180)
    circle(400, -20)
    left(165)
    circle(200, 40)
    left(190)
    circle(400, -40)
    circle(200, -40)
    # 轮廓,右
    penup()
    goto(-170, 160)
    left(190)
    pendown()
    circle(150, 40)
    right(180)
    circle(180, -30)
    left(170)
    circle(50, 80)
    circle(400, 20)
    penup()


# 右手
def rightHand():
    goto(-200, -130)
    right(120)
    pendown()
    circle(200, 20)
    circle(60, 120)
    circle(400, 14)
    penup()
    goto(-170, -190)
    pendown()
    left(175)
    circle(200, -30)
    penup()


# 左手
def leftHand():
    goto(130, -175)
    pendown()
    left(20)
    circle(250, 64)
    circle(10, 110)
    circle(300, 40)
    penup()


# 肚子
def tummy():
    goto(-210, -278)
    left(80)
    pendown()
    circle(50, -10)
    right(210)
    circle(400, 20)
    circle(50, 50)
    circle(400, 5)
    penup()
    # 斑点一
    fillcolor("#ce7f38")
    goto(206, -220)
    right(120)
    begin_fill()
    circle(40, 40)
    circle(5, 120)
    right(20)
    circle(40, 41)
    end_fill()
    # 斑点二
    goto(235, -350)
    left(160)
    begin_fill()
    circle(50, 50)
    circle(5, 120)
    right(15)
    circle(50, 45)
    end_fill()


def leftEye():
    penup()
    goto(80, 90)
    left(180)
    pendown()
    goto(30, 60)
    penup()
    left(45)
    # 黑眼
    fillcolor("#1c1c1b")
    begin_fill()
    circle(44, 295)
    end_fill()
    # 白眼
    fillcolor("#f7ebfc")
    goto(60, 65)
    begin_fill()
    circle(12, 360)
    end_fill()


def rightEye():
    goto(-160, 100)
    pendown()
    goto(-105, 70)
    penup()
    goto(-107, 72)
    # 黑眼
    fillcolor("#1c1c1b")
    begin_fill()
    right(110)
    circle(100, -45)
    circle(20, -95)
    right(25)
    circle(100, -43)
    end_fill()
    # 白眼
    fillcolor("#f7ebfc")
    goto(-150, 75)
    begin_fill()
    circle(12, 360)
    end_fill()


# 红脸 左
def leftBlush():
    goto(75, -5)
    pendown()
    fillcolor("#f24a23")
    begin_fill()
    right(40)
    circle(50, 360)
    end_fill()
    penup()


# 红脸右
def rightBlush():
    goto(-215, 10)
    right(35)
    pendown()
    begin_fill()
    circle(50, -135)
    right(62)
    circle(50, -75)
    goto(-217, 10)
    end_fill()
    penup()


# 鼻子
def nose():
    goto(-90, 20)
    pendown()
    fillcolor("#2a0f00")
    begin_fill()
    right(48)
    circle(30, -30)
    right(90)
    circle(30, -30)
    right(80)
    circle(30, -30)
    end_fill()
    penup()


# 嘴巴
def mouth():
    goto(-90, -30)
    left(150)
    pendown()
    circle(30, -130)
    penup()
    goto(-90, -30)
    pendown()
    circle(100, 40)
    circle(30, 110)


if __name__ == '__main__':
    leftEar()
    rightEar()
    head()
    rightHand()
    leftHand()
    tummy()
    leftEye()
    rightEye()
    leftBlush()
    rightBlush()
    nose()
    mouth()
    done()

运行效果:

用python画logo 用python画枫叶_用python画logo_09

 

from turtle import *

def go_to(x, y):
    penup()
    goto(x, y)
    pendown()

def help_do():
    go_to(-400, 0)
    forward(800)
    go_to(-400, 100)
    forward(800)
    go_to(-400,200)
    forward(800)
    go_to(-400, -100)
    forward(800)
    go_to(-400, -200)
    forward(800)
    left(90)
    go_to(0,-300)
    forward(600)
    go_to(100, -300)
    forward(600)
    go_to(-100, -300)
    forward(600)
    go_to(-200, -300)
    forward(600)
    go_to(200, -300)
    forward(600)

def head():
    go_to(-200, 180)
    fillcolor('yellow')
    begin_fill()
    seth(-30)
    for _ in range(6):
        circle(36, 60)
        circle(-36, 60)
    seth(-125)
    for _ in range(5):
        circle(40,60)
        circle(-40,60)
    seth(-210)
    for _ in range(4):
        circle(45,60)
        circle(-45,60)
    seth(65)
    for _ in range(5):
        circle(40,60)
        circle(-40,60)
    end_fill()

def eye():
    # 眼白
    go_to(14, -5)
    fillcolor('#f0f0f0')
    begin_fill()
    circle(65, 360)
    end_fill()
    begin_fill()
    go_to(13,12)
    seth(98)
    circle(-65,360)
    end_fill()

    #眼球
    go_to(-10,20)
    fillcolor('blue')
    begin_fill()
    circle(20,360)
    end_fill()
    go_to(-22,20)
    fillcolor('black')
    begin_fill()
    circle(7,360)
    end_fill()
    go_to(40,15)
    fillcolor('blue')
    begin_fill()
    circle(-20, 360)
    end_fill()
    go_to(53,15)
    fillcolor('black')
    begin_fill()
    circle(-7,360)
    end_fill()

    #睫毛
    go_to(-95,65)
    left(20)
    forward(40)
    go_to(-50,87)
    right(25)
    forward(32)
    go_to(0,70)
    right(25)
    forward(40)

    go_to(40, 75)
    left(35)
    forward(40)
    go_to(90, 87)
    right(18)
    forward(30)
    go_to(120, 70)
    right(25)
    forward(40)

def nose():
    fillcolor('yellow')
    go_to(0, -7)
    begin_fill()
    right(50)
    circle(-60, 30)
    color('yellow')
    goto(15,-40)
    end_fill()
    color('black')
    go_to(0, -7)
    seth(-75)
    forward(30)
    go_to(30,-7)
    seth(-105)
    forward(30)

def mouth():
    go_to(-120, - 60)
    seth(-45)
    circle(200, 30)
    seth(0)
    forward(100)
    seth(15)
    circle(200, 30)

def tooth():
    go_to(-30,-114)
    seth(-95)
    fillcolor('white')
    begin_fill()
    forward(30)
    seth(0)
    forward(40)
    seth(95)
    forward(30)
    go_to(-30,-114)
    end_fill()

    go_to(30, -114)
    seth(-95)
    fillcolor('white')
    begin_fill()
    forward(30)
    seth(0)
    forward(40)
    seth(95)
    forward(30)
    go_to(60, -114)
    end_fill()

def hole():
    go_to(-160,160)
    # fillcolor('#ffd700')
    # begin_fill()
    circle(30, 360)
    # a=1
    # for i in range(120):
    #     if 0<=i<30 or 60<=i<90:
    #         a=a+0.2
    #         lt(3)
    #         forward(a)
    #     else:
    #         a=a-0.2
    #         lt(3)
    #         forward(a)
    # end_fill()

def face():
    eye()
    nose()
    mouth()
    tooth()
    # hole()

def body():
    go_to(-170,-180)
    seth(-120)
    circle(150, 30)
    seth(0)
    forward(40)
    seth(100)
    forward(35)
    seth(-80)
    forward(100)
    fillcolor('brown')
    begin_fill()
    seth(0)
    forward(300)
    seth(80)
    forward(110)
    seth(-100)
    forward(65)
    seth(180)
    forward(315)
    go_to(-118,-400)
    end_fill()
    go_to(-170,-255)
    fillcolor('yellow')
    begin_fill()
    seth(-75)
    forward(80)
    seth(0)
    forward(17)
    seth(105)
    forward(85)
    end_fill()

    go_to(200, -170)
    seth(-60)
    circle(-150,30)
    seth(-180)
    forward(45)
    begin_fill()
    seth(0)
    forward(20)
    seth(-100)
    forward(85)
    seth(180)
    forward(20)
    end_fill()

def tie():
    go_to(-50,-225)
    seth(-40)
    forward(40)
    seth(30)
    forward(52)
    go_to(30,-225)
    seth(-30)
    forward(40)
    seth(40)
    forward(45)
    fillcolor('red')
    go_to(0, -240)
    begin_fill()
    seth(-60)
    forward(10)
    seth(0)
    forward(30)
    seth(60)
    forward(15)
    go_to(30,-225)
    end_fill()
    go_to(4,-250)
    begin_fill()
    seth(-100)
    forward(80)
    seth(0)
    forward(55)
    seth(100)
    forward(80)
    end_fill()

def spongeBob():
    # help_do()
    head()
    face()
    body()
    tie()

if __name__=='__main__':
    screensize(800, 600, 'white')
    pensize(3)
    speed(10)
    go_to(0, 0)
    spongeBob()
    go_to(-100,240)
    write('海绵宝宝',font=('BRUSHSCI.TTF', '30', 'bold'))
    mainloop()

运行效果:

用python画logo 用python画枫叶_阴影效果_10

 

import turtle as t

# 初始化
screen = t.Screen()
width, height = 700, 700
screen.setup(width, height)
t.bgcolor('#FEFFEF')
screen.title('哆啦A梦')
t.speed(10)



def skip(x, y):
	t.penup()
	t.goto(x, y)
	t.pendown()


# 修改坐标
def setxy():
	t.setworldcoordinates(0, -700, 700, 0)



def broad():
	# 头
	skip(368, -352)
	t.seth(15)
	t.fillcolor('#02A0E9')
	t.begin_fill()
	t.circle(160, 285)

	(x1, y1) = t.pos()  # 项链起点

	# 身体
	t.seth(119)
	t.circle(-160, 15)
	t.seth(140)
	t.forward(44)
	t.seth(-95)
	(x2, y2) = t.pos()  # 左手起点 t.circle(30)
	t.circle(-30, 90)
	t.seth(-75)
	t.circle(250, 23)
	(x3, y3) = t.pos()  # 左边线条
	t.seth(-115)
	t.circle(500, 7)
	t.seth(90)
	t.circle(10, 170)
	(x4, y4) = t.pos()  # 左脚起点
	t.seth(-75)
	t.circle(-180, 34)
	t.seth(-1)
	t.circle(-180, 45)
	t.circle(200, 25)
	(x5, y5) = t.pos()  # 右脚起点
	t.seth(1)
	t.circle(50, 125)
	t.seth(110)
	t.forward(8)
	t.seth(65)
	t.circle(250, 15)
	t.seth(-2)
	t.circle(-100, 40)
	(x6, y6) = t.pos()  # 右手起点
	t.seth(100)
	t.circle(-40, 90)
	t.seth(128)
	t.circle(155, 45)
	t.seth(-3)
	t.forward(18)
	t.circle(5, 190)
	t.end_fill()

	# 项链
	skip(x1, y1)
	t.seth(180)
	t.fillcolor('#DF0121')
	t.begin_fill()
	t.circle(8, 180)
	t.seth(-23)
	t.forward(15)
	(x10, y10) = t.pos()
	t.forward(40)
	(x7, y7) = t.pos()  # 铃铛起点
	t.seth(-23)
	t.forward(120)
	t.seth(-3)
	t.forward(20)
	t.circle(6, 190)
	t.seth(157)
	t.forward(187)
	t.end_fill()

	# 口袋
	skip(x10, y10)
	t.seth(-150)
	t.fillcolor('#FFFFFF')
	t.begin_fill()
	t.circle(90, 255)
	t.seth(158)
	t.forward(130)
	t.end_fill()

	skip(180, -350)
	t.seth(-18)
	t.circle(-500, 17)
	t.seth(-120)
	t.circle(-65, 95)
	t.seth(158)
	t.circle(-65, 95)

	# 铃铛
	skip(x7, y7)
	t.seth(-130)
	t.fillcolor('#F4E844')
	t.begin_fill()
	t.circle(100, 2)
	t.seth(157)
	t.circle(3, 180)
	(x8, y8) = t.pos()  # 铃铛2起点
	t.seth(-10)
	t.circle(-80, 30)
	t.seth(25)
	t.circle(5, 120)
	t.seth(140)
	t.circle(72, 35)
	t.seth(35)
	t.circle(-27, 119)
	t.seth(140)
	t.circle(70, 30)
	skip(x8, y8)
	t.seth(-130)
	t.circle(23, 100)
	(x9, y9) = t.pos()  # 铃铛3起点
	t.seth(-23)
	t.circle(23, 105)
	t.end_fill()
	skip(x9, y9)
	t.seth(60)
	t.forward(10)
	t.seth(-23)
	t.fillcolor('#7A6752')
	t.begin_fill()
	t.circle(6)
	t.end_fill()

	# 左手
	skip(x2, y2)
	t.seth(-95)
	t.fillcolor('#FFFFFF')
	t.begin_fill()
	t.circle(-35)
	t.end_fill()

	# 左脚
	skip(x4, y4)
	t.seth(90)
	t.fillcolor('#FFFFFF')
	t.begin_fill()
	t.circle(40, 130)
	t.seth(240)
	t.circle(150, 40)
	t.circle(53, 113)
	t.seth(70)
	t.circle(180, 34)
	t.end_fill()

	# 右脚
	skip(x5, y5)
	t.seth(-90)
	t.fillcolor('#FFFFFF')
	t.begin_fill()
	t.circle(40, 130)
	t.seth(50)
	t.circle(120, 50)
	t.circle(32, 125)
	t.seth(-60)
	t.forward(20)
	t.seth(-80)
	t.circle(-57, 100)
	t.end_fill()

	# 右手
	skip(x6, y6)
	t.seth(-60)
	t.fillcolor('#FFFFFF')
	t.begin_fill()
	t.circle(35)
	t.end_fill()

	# 脸
	skip(x1, y1)
	t.seth(120)
	t.fillcolor('#FFFFFF')
	t.begin_fill()
	t.circle(-160, 30)
	t.circle(-100, 90)
	(x12, y12) = t.pos()  # 左眼角的坐标
	t.seth(65)
	t.circle(-80, 30)
	t.seth(50)
	t.circle(-27, 140)
	t.seth(-85)
	t.circle(-80, 30)
	t.seth(70)
	t.circle(-80, 30)
	t.seth(50)
	t.circle(-27, 140)
	t.seth(-85)
	t.circle(-80, 30)
	# (x13,y13)=t.pos()  #右眼角的坐标
	t.seth(-10)
	t.circle(-70, 100)
	t.seth(-105)
	t.circle(-150, 60)
	t.seth(156)
	t.forward(173)
	t.end_fill()
	# 眼睛
	skip(x12, y12)
	t.seth(-120)
	t.circle(35, 170)
	t.circle(80, 15)
	t.seth(-118)
	t.circle(35, 170)
	t.circle(80, 10)

	skip(315, -110)
	t.fillcolor('#060608')
	t.begin_fill()
	t.circle(7, 180)
	t.seth(-125)
	t.circle(30, 50)
	t.circle(7, 180)
	t.seth(60)
	t.circle(30, 50)
	t.end_fill()
	skip(313, -115)
	t.fillcolor('#FFFFFF')
	t.begin_fill()
	t.circle(6)
	t.end_fill()

	skip(345, -130)
	t.seth(50)
	t.circle(-20, 180)

	# 鼻子
	skip(310, -180)
	t.fillcolor('#DB0220')
	t.begin_fill()
	t.seth(-20)
	t.circle(20)
	t.end_fill()

	t.seth(-120)
	t.forward(25)

	skip(310, -148)
	t.fillcolor('#FFFFFF')
	t.begin_fill()
	t.circle(7)
	t.end_fill()

	# 嘴巴
	skip(205, -160)
	t.fillcolor('#DF022A')
	t.begin_fill()
	t.seth(-90)
	t.circle(200, 20)
	(x14, y14) = t.pos()  # 舌头起点
	t.seth(-83)
	t.circle(100, 50)

	t.seth(-20)
	t.circle(100, 50)
	t.circle(150, 30)
	t.circle(5, 120)
	t.seth(171)
	t.circle(-500, 23)
	t.seth(-150)
	t.circle(5, 100)
	t.end_fill()

	# 舌头
	skip(x14, y14)
	t.fillcolor('#EC7A1A')
	t.begin_fill()
	t.seth(-83)
	t.circle(100, 50)
	t.seth(-20)
	t.circle(100, 50)
	t.seth(115)
	t.circle(100, 85)
	t.end_fill()

	# 胡子
	skip(260, -170)
	t.seth(155)
	t.forward(100)

	skip(265, -162)
	t.seth(140)
	t.forward(100)

	skip(265, -155)
	t.seth(130)
	t.forward(100)

	skip(350, -180)
	t.seth(-5)
	t.forward(100)

	skip(350, -189)
	t.seth(-10)
	t.forward(100)

	skip(350, -197)
	t.seth(-15)
	t.forward(100)

def main():
	setxy()
	broad()
	t.hideturtle()
	t.mainloop()

if __name__ == "__main__":
	main()

运行效果:

用python画logo 用python画枫叶_背景色_11

 

from turtle import *
setup(1000,700)
tracer(0)
ht()
 
#无轨迹跳跃
def my_goto(x, y):
    penup()
    goto(x, y)
    pendown()
 
#脸
def 脸():
    my_goto(200,0)
    pensize(4)
 
    #外圈
    fillcolor('deepskyblue')
    begin_fill()
    for i in range(1000):
        lt(360/1000)
        fd(1)
    end_fill()
 
    #内圈
    fillcolor('white')
    begin_fill()
    for i in range(300):
        lt(0.36)
        fd(1)
    for i in range(170):
        lt(0.6)
        fd(1)
    fd(90)
    for i in range(363):
        lt(0.36)
        fd(0.72)
    end_fill()
 
    #嘴巴
    my_goto(320,193)
    lt(120)
    for i in range(110):
        rt(2)
        fd(1)
    for i in range(320):
        fd(1)
        rt(0.3)
    my_goto(270,100)
    lt(315)
    for i in range(160):
        fd(0.8)
        lt(0.2)
 
    #隐藏
    my_goto(320,193)
    pencolor('white')
    pensize(20)
    fd(20)
    pencolor('white')
    lt(-37)
    my_goto(350,170)
    for i in range(45):
        lt(360/1000)
        fd(1)
    pensize(4)
    pencolor('black')
 
#围巾
def 围巾(): 
    my_goto(50,100)
    fillcolor('red')
    lt(180)
    pensize(1)
    begin_fill()
    for i in range(300):
        lt(360/1000)
        fd(1)
    pensize(4)
    lt(190)
    for i in range(630):
        rt(0.2)
        fd(0.5)
    end_fill()
 
#身子
def 身子():
    my_goto(45,120)
    fillcolor('deepskyblue')
    begin_fill()
    lt(70)
    for i in range(230):
        fd(0.8)
        lt(0.4)
    lt(180)
    fd(20)
    lt(90)
    for i in range(50):
        fd(0.6)
        lt(0.9)
    for i in range(40):
        fd(1)
        lt(0.5)
    for i in range(320):
        fd(0.4)
        lt(0.5)
    rt(70)
    for i in range(180):
        fd(1)
        lt(0.3)
    lt(110)
    fd(20)
    rt(180)
    fd(30)
    for i in range(120):
        fd(1)
        lt(1)
    lt(20)
    for i in range(30):
        fd(1)
        lt(1)
    fd(10)
    rt(-56)
    pensize(4)
    for i in range(400):
        rt(0.2)
        fd(0.5)
    lt(20)
    for i in range(60):
        rt(0.36)
        fd(0.5)
    end_fill()
 
#手
def 手():
    my_goto(200,-7)
    pencolor('black')
    fillcolor('white')
    begin_fill()
    circle(30)
    end_fill()
    my_goto(210,-10)
    fillcolor('deepskyblue')
    begin_fill()
    rt(110)
    fd(50)
    for i in range(90):
        fd(1)
        lt(1)
    lt(130)
    for i in range(45):
        fd(1)
        rt(1)
    lt(60)
    for i in range(130):
        rt(0.2)
        fd(0.5)
    end_fill()
    my_goto(320,20)
    lt(190)
    for i in range(65):
        fd(1)
        lt(1.5)
 
#铃铛
def 铃铛():
    my_goto(250,-10)
    fillcolor('yellow')
    begin_fill()
    circle(25)
    end_fill()
    my_goto(240,-10)
    fillcolor('black')
    begin_fill()
    circle(5)
    end_fill()
 
#脚
def 脚():
    my_goto(-80,40)
    lt(40)
    fd(20)
    lt(30)
    for i in range(150):
        fd(0.8)
        lt(0.3)
    lt(20)
    for i in range(100):
        fd(1)
        lt(1.5)
 
#尾巴
def 尾巴():
    my_goto(-30,100)
    lt(40)
    for i in range(100):
        fd(0.8)
        lt(0.2)
    my_goto(-20,180)
    fillcolor('red')
    begin_fill()
    circle(20)
    end_fill()
 
#肚子袋子
def 袋子肚子():
    my_goto(90,-80)
    fillcolor('white')
    begin_fill()
    for i in range(140):
        fd(1)
        lt(1)
    lt(83)
    for i in range(120):
        fd(1)
        lt(0.5)
    end_fill()
    my_goto(70,-80)
    lt(90)
    for i in range(140):
        fd(0.5)
        lt(1)
 
#眼睛
def 眼睛():
    #左眼
    pensize(4)
    my_goto(190,245)
    fillcolor('white')
    begin_fill()
    rt(-20)
    tracer(False)
    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)
    tracer(True)
    end_fill()
 
    #左眼珠
    my_goto(185,240)
    fillcolor('black')
    begin_fill()
    tracer(False)
    a = 1.7
    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)
    tracer(True)
    end_fill()
 
    #左眼珠瞳孔
    my_goto(185,240)
    fillcolor('white')
    begin_fill()
    tracer(False)
    a = 1.4
    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)
    tracer(True)
    end_fill()
 
    #右眼
    my_goto(240,280)
    fillcolor('white')
    begin_fill()
    lt(5)
    tracer(False)
    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)
    tracer(True)
    end_fill()
 
    #右眼珠
    my_goto(235,270)
    fillcolor('black')
    begin_fill()
    tracer(False)
    a = 1.7
    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)
    tracer(True)
    end_fill()
 
    #右眼珠瞳孔
    my_goto(235,270)
    fillcolor('white')
    begin_fill()
    tracer(False)
    a = 1.4
    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)
    tracer(True)
    end_fill()
 
    #鼻子
    my_goto(240,230)
    fillcolor('red')
    begin_fill()
    circle(20)
    end_fill()
 
    #鼻尖
    my_goto(236,228)
    pencolor('white')
    fillcolor('white')
    begin_fill()
    circle(8)
    end_fill()
 
#胡须
def 胡须():
    pensize(2)
    my_goto(90,200)
    lt(90)
    fd(100)
    my_goto(90,150)
    lt(10)
    fd(100)
    my_goto(100,70)
    lt(20)
    fd(100)
    my_goto(320,160)
    rt(10)
    fd(100)
    my_goto(330,190)
    rt(-10)
    fd(100)
    my_goto(290,200)
    lt(10)
    fd(100)
    my_goto(500,900)
    lt(90)
    fd(100)
    circle(0.5)
 
脸()
围巾()
身子()
手()
铃铛()
脚()
尾巴()
袋子肚子()
胡须()
眼睛()
done()

运行效果:

用python画logo 用python画枫叶_用python画logo_12