python画冰墩墩代码简单,python画冰墩墩代码简易

外向交货单批次赋值的标准姿势:用 BAPI_OUTB_DELIVERY_CHANGE 把 LIPS-CHARG 改得稳、改得干净 摘要: 外向交货单批次赋值涉及严格的业务约束,包括批次管理状态、单据状态、拆分规则等,直接更新表 LIPS 不可取。推荐使用 BAPI_OUTB_DELIVERY_CHANGE 接口,通过标准业务逻辑实现批次修改。关键点包括:区分单批次分配与批次拆分场景,正确设置 ITEM_CONTROL 控制结构,并确保单位/数量数据完整。附可直接执行的ABAP代码示例,实现安全可靠的批次更新流程。 (字数:149字) 阅读详情

大家好,小编为大家解答python画冰墩墩代码怎么运行的问题。很多人还不知道python画冰墩墩代码简单,现在让我们一起来看看吧!

一、满树樱花

说明:
以下项目我是在ipython里面运行的:
ipython安装方式: pip install ipython
当然我这里已经有了所以才是下面的结果
在这里插入图片描述

然后在控制台输入 ipython 命令,将代码复制进去运行即可
在这里插入图片描述
当然在你写完之后,你可以将这代码打包成可执行文件,这样就可以点击直接运行了,命令如下:

pyinstaller -F -w [文件名].py

# coding=utf-8
# 画一棵樱花
 
 
import turtle
import random
from turtle import *
from time import sleep
 
 
# 画樱花的躯干(60,t)
def tree(branchLen,t):
    sleep(0.0005)
    if branchLen >3:
        if 8<= branchLen <=12:
            if random.randint(0,2) == 0:
                t.color('snow') # 白
            else:
                t.color('lightcoral') # 淡珊瑚色
            t.pensize(branchLen / 3)
        elif branchLen <8:
            if random.randint(0,1) == 0:
                t.color('snow')
            else:
                t.color('lightcoral') # 淡珊瑚色
            t.pensize(branchLen / 2)
        else:
            t.color('sienna') # 赭(zhě)色
            t.pensize(branchLen / 10) # 6
        t.forward(branchLen)
        a = 1.5 * random.random()
        t.right(20*a)
        b = 1.5 * random.random()
        tree(branchLen-10*b, t)
        t.left(40*a)
        tree(branchLen-10*b, t)
        t.right(20*a)
        t.up()
        t.backward(branchLen)
        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)
 
def main():
    # 绘图区域
    t = turtle.Turtle()
    # 画布大小
    w = turtle.Screen()
    t.hideturtle() # 隐藏画笔
    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()
 
main()

效果图

在这里插入图片描述

二、樱花

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()

效果图
樱花
三、落花

from turtle import *
import random

def drawTree(length):
    if length>1:
        if length<30 and length>14:#缩小一下树干
            pensize(4)
        elif length<15 and length>5:#长度这个范围内那么就是绿叶
            color('#04B486')#
            pensize(3)
        elif length<5 and length>1:#红花
            color('#FE2E9A')
            pensize(2)
        else:
            color('#5E5E5E')#其他范围就是正常的树干
            pensize(5)
        #随机角度与长度
        randangle=2*random.random()
        randlen=2*random.random()
        
        #每次使用函数先绘制线段,再调整角度,这里是向右的角度转动
        fd(length)
        right(20*randangle)
        drawTree(length - 10*randlen)
        
        #这里是向左的角度转动
        left(40 * randangle)
        drawTree(length - 10*randlen)
        
        #为什么需要再向右转20度?那是因为我一共向左转了40度,使用backward后退,必须是相同的角度,不然退回去角度就不同了位置就不会对
        right(20 * randangle)

        up()
        backward(length)
        down()
def fallingFlowers(m):
    x,y=-1000,-750
    for i in range(30):
        up()
        goto(x,y)
        x+=100
        down()
        yval=50
        for i in range(m):
            a = 100*random.random()
            b = 2*random.random()
            print(a)
            if a>59:
                color('#FE2E9A')
            else:
                color('#04B486')
            circle(5)
            up()
            goto(x,y+(yval*b))
            fd(a)
            yval+=50
            down()      
            
setworldcoordinates(-1000,-750,1000,750)        
tracer(False)

fallingFlowers(10)#绘制落叶
bgcolor("#F5F6CE")
color('#5E5E5E')
pensize(5)

up()
goto(0,-700)#跳到绘制起始点
down()

left(80)
fd(140)
drawTree(120)

input()

效果图
在这里插入图片描述

如过有闪退,一般都是版本问题:
解决办法:

python2.*后面加上:raw_input()

python3.*后面加上:input()

四、画个爱心

from turtle import *


def go_to(x, y):
  up()
  goto(x, y)
  down()


def big_Circle(size):  #函数用于绘制心的大圆
  speed(10)
  for i in range(150):
      forward(size)
      right(0.3)

def small_Circle(size):  #函数用于绘制心的小圆
  speed(10)
  for i in range(210):
      forward(size)
      right(0.786)

def line(size):
  speed(10)
  forward(51*size)

def heart( x, y, size):
  go_to(x, y)
  left(150)
  begin_fill()
  line(size)
  big_Circle(size)
  small_Circle(size)
  left(120)
  small_Circle(size)
  big_Circle(size)
  line(size)
  end_fill()

def arrow():
  pensize(10)
  setheading(0)
  go_to(-400, 0)
  left(15)
  forward(150)
  go_to(339, 178)
  forward(150)

def arrowHead():
  pensize(1)
  speed(20)
  color('red', 'red')
  begin_fill()
  left(120)
  forward(20)
  right(150)
  forward(35)
  right(120)
  forward(35)
  right(150)
  forward(20)
  end_fill()


def main():
  pensize(2)
  color('red', 'pink')
  #getscreen().tracer(30, 0) #取消注释后,快速显示图案
  heart(200, 0, 1)          #画出第一颗心,前面两个参数控制心的位置,函数最后一个参数可控制心的大小
  setheading(0)             #使画笔的方向朝向x轴正方向
  heart(-80, -100, 1.5)     #画出第二颗心
  arrow()                   #画出穿过两颗心的直线
  arrowHead()               #画出箭的箭头
  go_to(400, -300)
  write("爱你的:渣渣", move=True, align="left", font=("宋体", 30, "normal")) #署名
  done()

main()

效果图:
在这里插入图片描述
五、画个圣诞树

from turtle import *
import random
import time
n = 80.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)

效果图如下:
在这里插入图片描述
六、豪华版圣诞树

import turtle as t  #as就是取个别名,后续调用的t都是turtle
from turtle import *
import random as r
import time
 
 
 
n = 100.0
 
speed("fastest")  #定义速度
screensize(bg='black')  #定义背景颜色,可以自己换颜色
left(90)
forward(3*n)
color("orange", "yellow")#定义最上端星星的颜色,外圈是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)
 
def drawlight():#定义画彩灯的方法
    if r.randint(0, 30) == 0:#如果觉得彩灯太多,可以把取值范围加大一些,对应的灯就会少一些
        color('tomato')#定义第一种颜色
        circle(6)#定义彩灯大小
    elif r.randint(0,30) == 1:
        color('orange')#定义第二种颜色
        circle(3)#定义彩灯大小
    else:
        color('dark green')#其余的随机数情况下画空的树枝
 
 
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)
    drawlight()#同时调用小彩灯的方法
    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 * r.random()
    b = 10 - 20 * r.random()
    up()
    forward(b)
    left(90)
    forward(a)
    down()
    if r.randint(0, 1) == 0:
            color('tomato')
    else:
        color('wheat')
    circle(2)
    up()
    backward(a)
    right(90)
    backward(b)
 
t.color("dark red","red")#定义字体颜色
t.write("Merry Christmas",align ="center",font=("Comic Sans MS",40,"bold"))#定义文字、位置、字体、大小
 
 
def drawsnow():#定义画雪花的方法
    t.ht()  #隐藏笔头,ht=hideturtle
    t.pensize(2)  #定义笔头大小
    for i in range(200): #画多少雪花
        t.pencolor("white") #定义画笔颜色为白色,其实就是雪花为白色
        t.pu() #提笔,pu=penup
        t.setx(r.randint(-350,350)) #定义x坐标,随机从-350到350之间选择
        t.sety(r.randint(-100,350)) #定义y坐标,注意雪花一般在地上不会落下,所以不会从太小的纵座轴开始
        t.pd() #落笔,pd=pendown
        dens = 6 #雪花瓣数设为6
        snowsize = r.randint(1,10) #定义雪花大小
        for j in range(dens): #就是6,那就是画5次,也就是一个雪花五角星
            #t.forward(int(snowsize))  #int()取整数
            t.fd(int(snowsize))
            t.backward(int(snowsize))
            #t.bd(int(snowsize))  #注意没有bd=backward,但有fd=forward,小bug
            t.right(int(360/dens))  #转动角度
 
drawsnow()#调用画雪花的方法
t.done()  # 完成,否则会直接关闭
time.sleep(10)

效果图
在这里插入图片描述
七、画个冰墩墩

# -*- coding:utf-8 -*-
import turtle as t

# 设置速度
t.speed(50)  # 速度
t.delay(10)  # 延迟

t.title('冰墩墩')
# t.bgcolor('red')
# 双耳
# 左耳
t.penup()
t.goto(-150, 200)
t.setheading(160)
t.begin_fill()
t.pendown()
t.circle(-30, 230)
t.setheading(180)
t.circle(37, 90)
t.end_fill()
# 右耳
t.penup()
t.goto(60, 200)
t.setheading(20)
t.begin_fill()
t.pendown()
t.circle(30, 230)
t.setheading(0)
t.circle(-37, 90)
t.end_fill()
# 头
t.pensize(5)
t.penup()
t.goto(-113, 237)
t.setheading(30)
t.pendown()
t.circle(-134, 60)

t.penup()
t.goto(-150, 200)
t.setheading(-120)
t.pendown()
t.circle(200, 80)

t.penup()
t.goto(60, 200)
t.setheading(-60)
t.pendown()
t.circle(-200, 80)

t.penup()
t.setheading(210)
t.pendown()
t.circle(-120, 60)
# 双眼
# 左眼
# 眼圈
t.speed(100)
t.penup()
t.goto(-140, 100)
t.setheading(-45)
t.begin_fill()
t.pendown()
a = 0.2
for i in range(120):
    if 0 <= i < 30 or 60 <= i < 90:
        a = a + 0.1
        t.speed(100)
        t.lt(3)  # 向左转3度
        t.fd(a)  # 向前走a的步长
    else:
        a = a - 0.1
        t.speed(100)
        t.lt(3)
        t.fd(a)
t.end_fill()
# 眼白
t.fillcolor("white")
t.penup()
t.goto(-103, 125)
t.setheading(0)
t.begin_fill()
t.pendown()
t.circle(14, 360)
t.end_fill()
# 眼珠
# t.fillcolor("sienna")
# t.pencolor("sienna")
t.penup()
t.goto(-102, 133)
t.setheading(0)
t.begin_fill()
t.pendown()
t.circle(6, 360)
t.end_fill()
# 右眼
# 眼圈
t.penup()
t.goto(50, 100)
t.setheading(45)
t.fillcolor("black")
t.pencolor("black")
t.begin_fill()
t.pendown()
a = 0.2
for i in range(120):
    if 0 <= i < 30 or 60 <= i < 90:
        a = a + 0.1
        t.speed(100)
        t.lt(3)  # 向左转3度
        t.fd(a)  # 向前走a的步长
    else:
        a = a - 0.1
        t.speed(100)
        t.lt(3)
        t.fd(a)
t.end_fill()
# 眼白
t.fillcolor("white")
t.penup()
t.goto(13, 125)
t.setheading(0)
t.begin_fill()
t.pendown()
t.circle(14, 360)
t.end_fill()
# 眼珠
# t.fillcolor("sienna")
# t.pencolor("sienna")
t.penup()
t.goto(12, 133)
t.setheading(0)
t.begin_fill()
t.pendown()
t.circle(6, 360)
t.end_fill()
# 鼻子
t.pencolor("black")
t.fillcolor("black")
t.penup()
t.goto(-55, 133)
t.begin_fill()
t.pendown()
t.fd(20)
t.seth(-120)
t.fd(20)
t.seth(120)
t.fd(20)
t.end_fill()
# 嘴
t.penup()
t.goto(-70, 110)
t.setheading(-30)
t.fillcolor("red")
t.begin_fill()
t.pendown()
t.circle(50, 60)
t.setheading(-120)
t.circle(-100, 15)
t.circle(-15, 90)
t.circle(-100, 15)
t.end_fill()
# 四肢
# 左臂
t.penup()
t.goto(-175, 100)
t.fillcolor("black")
t.begin_fill()
t.setheading(-120)
t.pendown()
t.fd(100)
t.setheading(-110)
t.circle(20, 180)
t.fd(30)
t.circle(-5, 160)
t.end_fill()
# 右臂
t.penup()
t.goto(85, 100)
t.setheading(60)
t.begin_fill()
t.pendown()
t.fd(100)
t.setheading(70)
t.circle(20, 180)
t.fd(30)
t.circle(-5, 160)
t.end_fill()
# 小红心
t.penup()
t.pencolor("red")
t.fillcolor('red')
t.goto(105, 200)
t.begin_fill()
t.pendown()
t.circle(-5, 180)
t.setheading(90)
t.circle(-5, 180)
t.setheading(-120)
t.fd(17)
t.penup()
t.goto(105, 200)
t.pendown()
t.setheading(-60)
t.fd(17)
t.end_fill()
t.pencolor("black")
t.fillcolor("black")
# 左腿
t.penup()
t.goto(-120, -45)
t.begin_fill()
t.pendown()
t.setheading(-90)
t.circle(-140, 20)
t.circle(5, 109)
t.fd(30)
t.circle(10, 120)
t.setheading(90)
t.circle(-140, 10)
t.end_fill()
# 右腿
t.penup()
t.goto(30, -45)
t.begin_fill()
t.pendown()
t.setheading(-90)
t.circle(140, 20)
t.circle(-5, 109)
t.fd(30)
t.circle(-10, 120)
t.setheading(90)
t.circle(140, 10)
t.end_fill()
# 冰糖外壳
t.pensize(3)
t.penup()
t.goto(-160, 195)
t.setheading(160)
t.pendown()
t.circle(-40, 230)
t.setheading(30)
t.circle(-134, 58)
t.setheading(60)
t.circle(-40, 215)
t.setheading(-60)
t.fd(15)
t.circle(2, 200)
t.setheading(65)
t.fd(30)
t.circle(-25, 180)
t.fd(100)
t.circle(2, 25)
t.circle(-200, 47)
t.circle(2, 60)
t.circle(140, 23)
t.circle(-2, 90)
t.setheading(180)
t.fd(70)
t.circle(-2, 90)
t.fd(30)
t.setheading(-160)
t.circle(-100, 35)
t.setheading(-90)
t.fd(30)
t.circle(-2, 90)
t.fd(70)
t.circle(-2, 90)
t.setheading(60)
t.circle(140, 30)
t.circle(2, 45)
t.circle(-200, 19)
t.circle(2, 130)
t.fd(30)
t.circle(-25, 180)
t.fd(100)
t.setheading(90)
t.circle(-200, 30)
# 冰糖面罩
t.pensize(3)
t.penup()
t.goto(65, 120)
t.setheading(90)
t.pendown()
t.pencolor("red")
a = 1
for i in range(120):
    if 0 <= i < 30 or 60 <= i < 90:  # 控制a的变化
        a = a + 0.25
        t.lt(3)  # 向左转3度
        t.fd(a)  # 向前走a的步长
    else:
        a = a - 0.25
        t.lt(3)
        t.fd(a)
t.pencolor("orange")
t.penup()
t.goto(66, 120)
t.pendown()
a = 1
for i in range(120):
    if 0 <= i < 30 or 60 <= i < 90:
        a = a + 0.255
        t.lt(3)
        t.fd(a)
    else:
        a = a - 0.255
        t.lt(3)
        t.fd(a)
t.pencolor("green")
t.penup()
t.goto(67, 120)
t.pendown()
a = 1
for i in range(120):
    if 0 <= i < 30 or 60 <= i < 90:
        a = a + 0.2555
        t.lt(3)
        t.fd(a)
    else:
        a = a - 0.2555
        t.lt(3)
        t.fd(a)
t.pencolor("deep sky blue")
t.penup()
t.goto(68, 120)
t.pendown()
a = 1
for i in range(120):
    if 0 <= i < 30 or 60 <= i < 90:
        a = a + 0.25955
        t.lt(3)
        t.fd(a)
    else:
        a = a - 0.25955
        t.lt(3)
        t.fd(a)
t.pencolor("pink")
t.penup()
t.goto(71, 120)
t.pendown()
a = 1
for i in range(120):
    if 0 <= i < 30 or 60 <= i < 90:
        a = a + 0.26
        t.lt(3)
        t.fd(a)
    else:
        a = a - 0.26
        t.lt(3)
        t.fd(a)
t.pencolor("purple")
t.penup()
t.goto(72, 120)
t.pendown()
a = 1
for i in range(120):
    if 0 <= i < 30 or 60 <= i < 90:
        a = a + 0.269
        t.lt(3)
        t.fd(a)
    else:
        a = a - 0.269
        t.lt(3)
        t.fd(a)

# 五环
t.penup()
t.goto(-55, -10)
t.pendown()
t.pencolor("blue")
t.circle(10)
t.penup()
t.goto(-40, -10)
t.pendown()
t.pencolor("black")
t.circle(10)
t.penup()
t.goto(-25, -10)
t.pendown()
t.pencolor("red")
t.circle(10)
t.penup()
t.goto(-50, -20)
t.pendown()
t.pencolor("yellow")
t.circle(10)
t.penup()
t.goto(-30, -20)
t.pendown()
t.pencolor("green")
t.circle(10)

# 输出文字
printer = t.Turtle()
printer.hideturtle()
printer.penup()
printer.goto(-350,-50)
printer.write("可\n\n",move = True, align="left", font=('宋体',40,'normal'))
printer.goto(-350,-100)
printer.write("爱\n\n",move = True, align="left", font=('宋体',40,'normal'))
printer.goto(-350,-150)
printer.write("冰\n\n",move = True, align="left", font=('宋体',40,'normal'))
printer.goto(-350,-200)
printer.write("墩\n\n",move = True, align="left", font=('宋体',40,'normal'))
printer.goto(-350,-250)
printer.write("墩\n\n",move = True, align="left", font=('宋体',40,'normal'))

t.hideturtle()
t.done()

效果图
在这里插入图片描述
八、画个皮卡丘

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

import turtle

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

class Pikaqiu:
    def __init__(self):
         self.t = turtle.Turtle()
         t = self.t
         t.pensize(3) # 画笔大小
         t.speed(9) #画笔速度
         t.ondrag(getPosition)


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

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

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

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

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

        self.onTrace_goto(x,y+10)
        t.fillcolor('#000000')
        t.begin_fill()
        t.circle(10)
        t.end_fill()
        
        self.onTrace_goto(x-6,y+22)
        t.fillcolor('#ffffff')
        t.begin_fill()
        t.circle(10)
        t.end_fill()
        
    def mouth(self,x,y):
        self.onTrace_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.onTrace_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.onTrace_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.onTrace_goto(-17,94)
        t.seth(8)
        t.fd(4)
        t.back(8)


    # 红脸颊
    def leftCheck(self,x,y):
        turtle.tracer(False)
        t = self.t
        self.onTrace_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 rightCheck(self,x,y):
        t = self.t
        turtle.tracer(False)
        self.onTrace_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.onTrace_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.onTrace_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.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)

        # 左脸轮廓
        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.seth(300)
        t.circle(10,80)
        t.seth(220)
        t.seth(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(110,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.onTrace_goto(130,125)
        t.seth(-20)
        t.fd(5)
        t.circle(-5,160)
        t.fd(5)

        # 手指纹
        self.onTrace_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.onTrace_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)
        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.end_fill()

        # 尾巴花纹
        t.fillcolor('#923E24')
        self.onTrace_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.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(30)
        t.left(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.leftCheck(-126,32)
        self.rightCheck(107,63)
        self.colorLeftEar(-250,100)
        self.colorRightEar(150,270)
        self.leftEye(-85,90)
        self.rightEye(50,110)
        t.hideturtle()

    def cap(self,x,y):
        self.onTrace_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(60)
        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)
        t.right(35)
        t.fd(50)
        t.right(35)
        t.fd(50)
        t.circle(8,100)
        t.end_fill()
        self.onTrace_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.onTrace_goto(-58,270)
        t.pencolor('#228B22')
        t.dot(35)
        self.onTrace_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.fillcolor('#228B22')

    def start(self):
        self.body()

def main():
    print(" Painting the Pikachu....")
    turtle.screensize(800,600)
    turtle.title("皮卡丘")
    pkq = Pikaqiu()
    pkq.start()

    turtle.mainloop() # running


if __name__ =='__main__':
    main()

效果图
在这里插入图片描述

九、生日蛋糕

# -*-coding:utf-8 -*-
import turtle as t
import math as m
import random as r

# 圆角弧度转化 x 轴 和y轴
def drawX(a, i):
    angle = m.radians(i)
    return a * m.cos(angle)


def drawY(b, i):
    angle = m.radians(i)
    return b * m.sin(angle)


# 设置背景颜色,窗口位置以及大小
t.bgcolor("#d3dae8")
t.setup(width=900, height=600, startx=0, starty=0)
t.title("永远十八,生日快乐!")
# 落笔速度
t.speed(2)
t.penup()
t.goto(150, 0)
t.pendown()

# 画个蛋糕底座 填充白色
t.pencolor("white")
t.begin_fill()
for i in range(360):
    x = drawX(150, i)
    y = drawY(60, i)
    t.goto(x, y)
t.fillcolor("#fef5f7")
t.end_fill()

# 2中心分割找到合适点 用粉色填充外圈
t.begin_fill()
for i in range(180):
    x = drawX(150, -i)
    y = drawY(70, -i)
    t.goto(x, y)
for i in range(180, 360):
    x = drawX(150, i)
    y = drawY(60, i)
    t.goto(x, y)
t.fillcolor("#f2d7dd")
t.end_fill()

# 3计算蛋糕的大小  画底层
t.pu() #动态生成函数
t.goto(120, 0)
t.pd()
t.begin_fill()
for i in range(360):
    x = drawX(120, i)
    y = drawY(48, i)
    t.goto(x, y)
t.fillcolor("#cbd9f9")
t.end_fill()

# 4画出第一层的蛋糕框架 蓝色填充
t.begin_fill()
t.pencolor("#fee48c")
for i in range(540):
    x = drawX(120, i)
    y = drawY(48, i) + 70
    t.goto(x, y)
t.goto(-120, 0)
t.fillcolor("#cbd9f9")
t.end_fill()

# 5 对第一层蛋糕进行美化 填充淡粉色
t.pu()
t.goto(120, 70)
t.pd()
t.pencolor("#fff0f3")
t.begin_fill()
for i in range(360):
    x = drawX(120, i)
    y = drawY(48, i) + 70
    t.goto(x, y)
t.fillcolor("#fff0f3")
t.end_fill()

# 6 开始画第二层蛋糕底座 填充乳白色
t.pu()
t.goto(110, 70)
t.pd()
t.pencolor("#fff9fb")
t.begin_fill()
for i in range(360):
    x = drawX(110, i)
    y = drawY(44, i) + 70
    t.goto(x, y)
t.fillcolor("#fff9fb")
t.end_fill()

# 7 进行蛋糕第一层的装饰 画底层红边
t.pu()
t.goto(120, 0)
t.pd()
t.begin_fill()
t.pencolor("#ffa79d")
for i in range(180):
    x = drawX(120, -i)
    y = drawY(48, -i) + 10
    t.goto(x, y)
t.goto(-120, 0)
for i in range(180, 360):
    x = drawX(120, i)
    y = drawY(48, i)
    t.goto(x, y)
t.fillcolor("#ffa79d")
t.end_fill()

# 8 第一层蛋糕的花边 波浪形描绘 并填充颜色
t.pu()
t.goto(120, 70)
t.pd()
t.begin_fill()
t.pensize(4)
t.pencolor("#fff0f3")
for i in range(1800):
    x = drawX(120, 0.1 * i)
    y = drawY(-18, i) + 10
    t.goto(x, y)
t.goto(-120, 70)
t.pensize(1)
for i in range(180, 360):
    x = drawX(120, i)
    y = drawY(48, i) + 70
    t.goto(x, y)
t.fillcolor("#fff0f3")
t.end_fill()

# 9 第一层算是弄好了 ,下面就是差不多的步骤
# 开始第二层蛋糕的画作 并填充颜色
t.pu()
t.goto(80, 70)
t.pd()
t.begin_fill()
t.pencolor("#6f3732")
t.goto(80, 120)
for i in range(180):
    x = drawX(80, i)
    y = drawY(32, i) + 120
    t.goto(x, y)
t.goto(-80, 70)
for i in range(180, 360):
    x = drawX(80, i)
    y = drawY(32, i) + 70
    t.goto(x, y)
t.fillcolor("#6f3732")
t.end_fill()


# 10 第二层顶层描边填充颜色
t.pu()
t.goto(80, 120)
t.pd()
t.pencolor("#ffaaa0")
t.begin_fill()
for i in range(360):
    x = drawX(80, i)
    y = drawY(32, i) + 120
    t.goto(x, y)
t.fillcolor("#ffaaa0")
t.end_fill()


# 11 第二层内圈 并填充颜色
t.pu()
t.goto(70, 120)
t.pd()
t.pencolor("#ffc3be")
t.begin_fill()
for i in range(360):
    x = drawX(70, i)
    y = drawY(28, i) + 120
    t.goto(x, y)
t.fillcolor("#ffc3be")
t.end_fill()


# 12 开始画第二层花边 并填充颜色
t.pu()
t.goto(80, 120)
t.pd()
t.begin_fill()
t.pensize(3)
t.pencolor("#ffaaa0")
for i in range(1800):
    x = drawX(80, 0.1 * i)
    y = drawY(-12, i) + 80
    t.goto(x, y)
t.goto(-80, 120)
t.pensize(1)
for i in range(180, 360):
    x = drawX(80, i)
    y = drawY(32, i) + 120
    t.goto(x, y)
t.fillcolor("#ffaaa0")
t.end_fill()

# 13 现在开始画蜡烛 总共画5个蜡烛
t.pu()
t.goto(64, 120)
t.pd()
t.pencolor("#b1c9e9")
t.begin_fill()
for i in range(360):
    x = drawX(4, i) + 60
    y = drawY(1, i) + 120
    t.goto(x, y)
t.goto(64, 170)
for i in range(540):
    x = drawX(4, i) + 60
    y = drawY(1, i) + 170
    t.goto(x, y)
t.goto(56, 120)
t.fillcolor("#b1c9e9")
t.end_fill()
# 进行蜡烛白色描边
t.pencolor("white")
t.pensize(2)
for i in range(1, 6):
    t.goto(64, 120 + 10 * i)
    t.pu()
    t.goto(56, 120 + 10 * i)
    t.pd()
# 蜡烛芯
t.pu()
t.goto(60, 170)
t.pd()
t.goto(60, 180)
t.pensize(1)

#14 蜡烛火苗
t.pu()
t.goto(64, 190)
t.pd()
t.pencolor("#f1add1")
t.begin_fill()
for i in range(360):
    x = drawX(4, i) + 60
    y = drawY(10, i) + 190
    t.goto(x, y)
t.fillcolor("#f1add1")
t.end_fill()

# 15 以下几个重复在不同位置画蜡烛
t.pu()
t.goto(-56, 120)
t.pd()
t.pencolor("#b1c9e9")
t.begin_fill()
for i in range(360):
    x = drawX(4, i) - 60
    y = drawY(1, i) + 120
    t.goto(x, y)
t.goto(-56, 170)
for i in range(540):
    x = drawX(4, i) - 60
    y = drawY(1, i) + 170
    t.goto(x, y)
t.goto(-64, 120)
t.fillcolor("#b1c9e9")
t.end_fill()
t.pencolor("white")
t.pensize(2)
for i in range(1, 6):
    t.goto(-56, 120 + 10 * i)
    t.pu()
    t.goto(-64, 120 + 10 * i)
    t.pd()
t.pu()
t.goto(-60, 170)
t.pd()
t.goto(-60, 180)
t.pensize(1)

#16
t.pu()
t.goto(-56, 190)
t.pd()
t.pencolor("#f1add1")
t.begin_fill()
for i in range(360):
    x = drawX(4, i) - 60
    y = drawY(10, i) + 190
    t.goto(x, y)
t.fillcolor("#f1add1")
t.end_fill()
# 15
t.pu()
t.goto(0, 130)
t.pd()
t.pencolor("#b1c9e9")
t.begin_fill()
for i in range(360):
    x = drawX(4, i)
    y = drawY(1, i) + 130
    t.goto(x, y)
t.goto(4, 180)
for i in range(540):
    x = drawX(4, i)
    y = drawY(1, i) + 180
    t.goto(x, y)
t.goto(-4, 130)
t.fillcolor("#b1c9e9")
t.end_fill()
t.pencolor("white")
t.pensize(2)
for i in range(1, 6):
    t.goto(4, 130 + 10 * i)
    t.pu()
    t.goto(-4, 130 + 10 * i)
    t.pd()
t.pu()
t.goto(0, 180)
t.pd()
t.goto(0, 190)
t.pensize(1)

#17 第三个蜡烛火苗
t.pu()
t.goto(4, 200)
t.pd()
t.pencolor("#f1add1")
t.begin_fill()
for i in range(360):
    x = drawX(4, i)
    y = drawY(10, i) + 200
    t.goto(x, y)
t.fillcolor("#f1add1")
t.end_fill()


# 18
t.pu()
t.goto(30, 110)
t.pd()
t.pencolor("#b1c9e9")
t.begin_fill()
for i in range(360):
    x = drawX(4, i) + 30
    y = drawY(1, i) + 110
    t.goto(x, y)
t.goto(34, 160)
for i in range(540):
    x = drawX(4, i) + 30
    y = drawY(1, i) + 160
    t.goto(x, y)
t.goto(26, 110)
t.fillcolor("#b1c9e9")
t.end_fill()
t.pencolor("white")
t.pensize(2)
for i in range(1, 6):
    t.goto(34, 110 + 10 * i)
    t.pu()
    t.goto(26, 110 + 10 * i)
    t.pd()
#19
t.pu()
t.goto(30, 160)
t.pd()
t.goto(30, 170)
t.pensize(1)

#20
t.pu()
t.goto(34, 180)
t.pd()
t.pencolor("#f1add1")
t.begin_fill()
for i in range(360):
    x = drawX(4, i) + 30
    y = drawY(10, i) + 180
    t.goto(x, y)
t.fillcolor("#f1add1")
t.end_fill()
# 17
t.pu()
t.goto(-30, 110)
t.pd()
t.pencolor("#b1c9e9")
t.begin_fill()
for i in range(360):
    x = drawX(4, i) - 30
    y = drawY(1, i) + 110
    t.goto(x, y)
t.goto(-26, 160)
for i in range(540):
    x = drawX(4, i) - 30
    y = drawY(1, i) + 160
    t.goto(x, y)
t.goto(-34, 110)
t.fillcolor("#b1c9e9")
t.end_fill()
t.pencolor("white")
t.pensize(2)
for i in range(1, 6):
    t.goto(-26, 110 + 10 * i)
    t.pu()
    t.goto(-34, 110 + 10 * i)
    t.pd()
t.pu()
t.goto(-30, 160)
t.pd()
t.goto(-30, 170)
t.pensize(1)

#  算是画完了蜡烛 总计第五个
t.pu()
t.goto(-26, 180)
t.pd()
t.pencolor("#f1add1")
t.begin_fill()
for i in range(360):
    x = drawX(4, i) - 30
    y = drawY(10, i) + 180
    t.goto(x, y)
t.fillcolor("#f1add1")
t.end_fill()

### 随机蛋糕碎末 花边点缀
color = ["#e28cb9", "#805a8c", "#eaa989", "#6e90b7", "#b8b68f", "#e174b5", "#cf737c", "#7c8782"]
# 蛋糕上来点色彩点缀
for i in range(80):
    t.pu()
    x = r.randint(-120, 120)
    y = r.randint(-25, 30)
    t.goto(x, y)
    t.pd()
    t.dot(r.randint(2, 5), color[r.randint(0, 7)])

# 增加点密度
for i in range(40):
    t.pu()
    x = r.randint(-90, 90)
    y = r.randint(-35, 10)
    t.goto(x, y)
    t.pd()
    t.dot(r.randint(2, 5), color[r.randint(0, 7)])

# 第二层同样的原理
for i in range(40):
    t.pu()
    x = r.randint(-80, 80)
    y = r.randint(60, 90)
    t.goto(x, y)
    t.pd()
    t.dot(r.randint(2, 5), color[r.randint(0, 7)])
for i in range(30):
    t.pu()
    x = r.randint(-50, 50)
    y = r.randint(45, 70)
    t.goto(x, y)
    t.pd()
    t.dot(r.randint(2, 5), color[r.randint(0, 7)])

# 外围环境也加点点缀 搞点氛围
for i in range(50):
    t.pu()
    x = r.randint(-500, 500)
    y = r.randint(120, 300)
    t.goto(x, y)
    t.pd()
    t.dot(r.randint(3, 5), color[r.randint(0, 7)])

# 找位置写生日快乐
t.seth(90)
t.pu()
t.goto(0, 0)
t.fd(210)
t.left(90)
t.fd(170)
t.pd()
t.write("Happy Birthday", font=("Curlz MT", 50))


# # 落款
# t.color('blue')
# t.penup()
# t.goto(-400, 210)
# t.pendown()
# t.write('致:远方的你  ', font=('楷体', 32, 'bold'))
# t.color('red')
# t.penup()
# t.goto(-300, 50)
# t.pendown()
# t.write('祝 你 生 日 快 乐,前 程 似 锦!', font=('楷体', 30, 'bold'))
# t.color('blue')
# t.penup()
# t.goto(100, -220)
# t.pendown()
# t.write('', font=('楷体', 20, 'bold'))
t.done()

效果图
在这里插入图片描述
十、画一朵漂亮的玫瑰花

# -*- coding: utf-8 -*-
import turtle as tl

tl.speed(0)
# 设置画面尺寸4笔画漂亮的玫瑰花')
tl.setup(600,650)
tl.title('这是一朵玫瑰花')
tl.up ()
tl.goto(-180,275)
# 坐标移至(-200,290)
# 设置文字颜色(蓝色)
# 设置比例因子,用数据的1/3大小绘制力设置玫瑰花居中与数据的位置偏移量畏替誓花暴势盘布笔、填充都为红色
# 绘制文字
tl.color('blue')
tl.write('漂亮的玫瑰花',align='center',font=('微软雅黑',24))
R= 1/3
x0,y0 = R*650,R*850
# 画花瓣背景(花瓣主体)
tl.goto(R*1109-x0,y0-R*308)
tl.color('red')
tl.seth(-25) 
tl.down()
tl.begin_fill()
tl.circle(-400*R,38) 
tl.rt(115) 
tl.circle(300*R,45) 
tl.circle(-700*R,20)
tl.circle(700*R,4) 
tl.circle(-550*R,10) 
tl.circle(-300*R,27)
tl.circle(50*R,35) 
tl.circle(-800*R,5) 
tl.circle(-60*R,70)
tl.circle(900*R,12) 
tl.circle(100*R,27) 
tl.circle(-800*R,14)
tl.circle(-30*R,121) 
tl.circle(-800*R,15) 
tl.lt(90) 
tl.circle(400*R,18)
tl.circle(-50*R,140) 
tl.lt(130) 
tl.circle(-130*R,110) 
tl.circle(100*R,30)
tl.circle(-450*R,20) 
tl.circle(-250*R,60) 
tl.lt(70) 
tl.circle(-130*R,60)
tl.circle(500*R,21) 
tl.circle(-130*R,95) 
tl.circle(-200*R,20)
tl.end_fill()



# 画花叶
tl.color('green')
# 设置花叶为绿色
tl.up()
tl.goto(R*560-x0,y0-R*1230)
tl.down()
tl.seth(80)
tl.begin_fill()

# 画第一片花叶
for i in range(5):
    tl.circle(410*R,20)
    tl.lt(120)
    tl.fd(35*R)
    tl.rt(120)
    
    
# 花叶起点坐标
# 画叶缘
tl.fd(160*R)
tl.lt(150)
tl.fd(150*R)

# 画叶缘
for i in range(4):
    tl.rt(130)
    tl.fd(30*R)
    tl.lt(120+i*3)
    tl.circle(600*R,11-i)
    
        
tl.rt(130)
tl.fd(30*R)
tl.lt(125)
tl.circle (500*R,30)
tl.end_fill()
tl.up()
tl.seth(-35)
tl.fd(150*R) 
tl.lt(185) 
tl.down()
# 叶脉用深绿色
tl.color('darkgreen')
# 画叶脉
tl.begin_fill()
tl.circle(-470*R,20)
tl.circle(750*R,25)
tl.fd(200*R)
tl.lt(175)
tl.fd(190*R)
tl.circle(-750*R,20)
tl.circle(500*R,15)
tl.fd(100*R)
tl.end_fill()
tl.up()
tl.lt(175)
tl.fd(250*R)
tl.rt(45) 
tl.down()  
tl.pensize(3) 
tl.fd(160*R)


for i in range(2):
    tl.up()
    tl.lt(120)
    tl.fd(110*R)
    tl.rt(115)
    tl.down()
    tl.fd((150-i*20)*R)

tl.up() 
tl.lt(140) 
tl.fd(150*R) 
tl.lt(120) 
tl.down()  
tl.fd(100*R)

for i in range(2):
    tl.up() 
    tl.rt(110) 
    tl.fd((100+i*5)*R)
    tl.lt(110)
    tl.down()
    tl.fd(140*R)

# 设置线条颜色和填充颜色同为绿色# 画第二片花叶
tl.color('green')
tl.up()
tl.seth(-80)
tl.fd(250*R) 
tl.pensize(1) 
tl.down ()  
tl.seth(125) 
tl.begin_fill()


for i in range(5):
    tl.circle(330*R,20)
    tl.lt(120)
    tl.fd(30*R)
    tl.rt(120)
tl.fd(130*R)
tl.lt(150)
tl.fd(120*R)

for i in range(4):
    tl.rt(130)
    tl.fd(25*R)
    tl.lt(120+i*3)
    tl.circle(460*R,11-i)
    
tl.rt(130) 
tl.fd(25*R) 
tl.lt(125) 
tl.circle(400*R,30) 
tl.end_fill()

tl.up()
tl.seth(12)
tl.fd(120*R)
tl.lt(182)
tl.down()

tl.color('darkgreen')
tl.begin_fill()
tl.circle(-380*R,20)
tl.circle(600*R,30)
tl.fd(130*R)
tl.lt(175)
tl.fd(120*R)
tl.circle(-600*R,25)
tl.circle(400*R,15)
tl.fd(80*R)
tl.end_fill()

tl.up() 
tl.lt(175) 
tl.fd(200*R) 
tl.rt(45) 
tl.down()  
tl.pensize(3)
tl.fd(150*R)

for i in range(2):
    tl.up()
    tl.lt(120) 
    tl.fd(90*R) 
    tl.rt(115) 
    tl.down() 
    tl.fd((100-i*15)*R)
    
tl.up() 
tl.lt(140) 
tl.fd(110*R)
tl.lt(120)
tl.down()
tl.fd(100*R)

for i in range(2):
    tl.up() 
    tl.rt(110)
    tl.fd((80+i*5)*R)
    tl.lt(110)
    tl.down()
    tl.fd(110*R)
    
tl.up()
tl.rt(10)
tl.fd(500*R)
tl.seth(90)

tl.color('green')
tl.pensize(1)
tl.begin_fill()


# 画第三片花叶
for i in range(5):
    tl.circle(-410*R,20)
    tl.rt(120) 
    tl.fd(35*R)
    tl.lt(120)
tl.fd(160*R)
tl.rt(150)
tl.fd(150*R)
    
for i in range(4):
    tl.lt(130)
    tl.fd(30*R)
    tl.rt(120+i*3)
    tl.circle(-600*R,11-i)

tl.lt(130)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
tl.fd(30*R)
tl.rt(125)
tl.circle(-500*R,30)
tl.end_fill()

tl.up()
tl.lt(40)
tl.fd(160*R)
tl.lt(180)
tl.down()


tl.color('darkgreen')
tl.begin_fill()
tl.circle(470*R,20)
tl.circle(-750*R,25)
tl.fd(200*R)
tl.rt(175)
tl.fd(190*R)
tl.circle(750*R,20)
tl.circle(-500*R,15)
tl.fd(100*R)
tl.end_fill()

tl.up ()
tl.rt(175)
tl.fd(250*R)
tl.lt(45)
tl.down()
tl.pensize(3)                                                                                                                                                                                                                                                                                                                                                                                                                                                               
tl.fd(160*R)

for i in range(2):
    tl.up()
    tl.rt(120)
    tl.fd(110*R)
    tl.lt(115)
    tl.down()
    tl.fd((150-i*20)*R)
    
tl.up() 
tl.rt(140)
tl.fd(150*R)
tl.rt(120)
tl.down()
tl.fd(100*R)

for i in range(2):
    tl.up()
    tl.lt(110)
    tl.fd((100+i*5)*R)
    tl.rt(110)
    tl.down()
    tl.fd(140*R)    
tl.lt(45)
tl.fd(230*R) 
tl.lt(45)
    
# 花梗色
tl.color('saddlebrown','#976123')
tl.begin_fill()
# 画花梗
tl.fd(460*R)
tl.circle(250*R,15)
tl.rt(120)
tl.circle(80*R,45)
tl.rt(100)
tl.circle(-100*R,35)
tl.circle(700*R,15)
tl.fd(360*R)
tl.circle(300*R,10)
tl.fd(220*R)
tl.rt(90)
tl.fd(35*R)
tl.rt(90)
tl.fd(220*R)
tl.circle(-320*R,10)
tl.fd(70*R);
tl.end_fill()

# 画花尊
tl.up()
tl.rt(160)
tl.fd(400*R)
tl.lt(80)
tl.pensize(1)
tl.color('darkgreen' ,'green')
tl.down()

tl.begin_fill()
tl.circle(520*R,10)
tl.circle(100*R,75)
tl.circle(-100*R,60)
tl.lt(150)
tl.circle(220*R,85)
tl.rt(140)
tl.circle(240*R,30)
tl.circle(-240*R,15)
tl.lt(140)
tl.circle(-240*R,20)
tl.circle(240*R,25)
tl.rt(120)
tl.circle(180*R,80)
tl.circle(100*R,40)
tl.lt(100)
tl.circle(-310*R,23)
tl.lt(57)
tl.circle(-520*R,35)                                                                                                                                                
tl.end_fill()                                                                                                                                                                                                                                                                                                                     

# 画花芯花瓣(蕃茄红色)
tl.up()
tl.seth(90)                                          
tl.fd(595*R)
tl.lt(90)
tl.fd(60*R)
tl.rt(120)
tl.down()

tl.color('tomato')
tl.begin_fill()
tl.circle(-80*R,45)
tl.circle(-30*R,120)
tl.circle(-10*R,50)
tl.circle(-250*R,30)
tl.circle(-20*R,60)
tl.circle(-80*R,100)
tl.circle(-290*R,40)
tl.circle(-110*R,90)
tl.circle(110*R,70)
tl.circle(-110*R,80)
tl.circle(-220*R,25)
tl.rt(70)
tl.fd(25*R)
tl.rt(110)
tl.circle(220*R,30)
tl.circle(80*R,70)
tl.circle(-120*R,30)
tl.lt(125)
tl.circle(200*R,20)
tl.rt(45)
tl.circle(220*R,50)
tl.rt(80)
tl.fd(21*R)
tl.rt(105)
tl.circle(-400*R,33)
tl.lt(50)
tl.circle(-240*R,15)
tl.circle(850*R,5)
tl.circle(90*R,87)
tl.circle(270*R,40)
tl.circle(60*R,100)
tl.circle(10*R,63)
tl.circle(250*R,25)
tl.lt(90)
tl.circle(28*R,100)
tl.end_fill()

tl.up()
tl.rt(150)
tl.fd(95*R)
tl.rt(30)
tl.begin_fill() 
tl.down()
tl.circle(-160*R,30)
tl.circle(-270*R,30)
tl.circle(-100*R,50)
tl.rt(150)
tl.circle(250*R,50)
tl.circle(150*R, 20)
tl.end_fill()

tl.up()
tl.lt(130)
tl.fd(280*R)
tl.rt(65)
tl.begin_fill()
tl.down()
tl.circle(-350*R,20)
tl.circle(-100*R,10)
tl.circle(-470*R,10)
tl.rt(110)
tl.fd(20*R)
tl.rt(60)
tl.circle(-470*R,8)
tl.circle(150*R,25)
tl.circle(470*R,8)
tl.circle(-30*R,50)
tl.end_fill()
tl.up()
tl.lt(186,)
tl.fd(480*R)
tl.lt(195)
tl.down()
tl.begin_fill()
tl.circle(-500*R,22)
tl.circle(280*R,20)
tl.circle(130*R,90)
tl.circle(15*R,175)
tl.fd(20*R)
tl.rt(105)
tl.circle(-300*R,70)
tl.rt(120)
tl.circle(-800*R,3)
tl.rt(70)
tl.circle(100*R,30)
tl.lt(160)
tl.circle(-50*R,75)
tl.circle (-100*R,100)
tl.circle(200*R,20)
tl.lt(30) 
tl.fd(25*R) 
tl.lt(135)
tl.fd(35*R)
tl.rt(95)
tl.circle(-100*R,80)
tl.circle(800*R,15)
tl.circle(-100*R,100)
tl.circle(-200*R,30)
tl.circle(800*R,20)
tl.circle(10*R,180)
tl.circle(-800*R,20)
tl.circle(220*R,22)
tl.circle(120*R,105)

tl.circle(-800*R,15)
tl.circle(110*R,90)
tl.rt(85)
tl.circle(-400*R,5)
tl.circle(130*R,100)
tl.rt(60);
tl.circle(600*R,5)
tl.rt(50)
tl.circle(600*R,5)
tl.circle(40*R,120)
tl.circle(600*R,15)
tl.lt(50)
tl.circle(-600*R,15)
tl.lt(130)
tl.circle(170*R,55)
tl.lt(165)
tl.circle(-160*R,40)
tl.rt(120)
tl.fd(90*R)
tl.rt(45)
tl.circle(-600*R,14)
tl.circle(-30*R,130)
tl.circle(500*R,20)
tl.circle(300*R,50)
tl.rt(95)
tl.circle(-120*R,85)
tl.circle(700*R,19)
tl.end_fill()

tl.up()
tl.rt(66)
tl.fd(150*R)
tl.rt(57)
tl.down()
tl.begin_fill()
tl.circle(50*R,50)
tl.fd(150*R)
tl.circle(600*R,8)
tl.circle(-200*R,10)
tl.circle(-30*R,145)
tl.circle(-300*R,45)
tl.circle(-350*R,20)
tl.circle(500*R,40)
tl.circle(-200*R,20)
tl.circle(-50*R,100)
tl.circle(-200*R,20)
tl.circle(-500*R,20)
tl.circle(-250*R,40)
tl.circle(-500*R,20)
tl.circle(-700*R,20)
tl.circle(100*R,45)
tl.fd(30*R)
tl.rt(180)
tl.circle(-120*R,45)
tl.circle(800*R,15)
tl.circle(500*R,25)
tl.circle(275*R,38)
tl.circle(500*R,27)
tl.circle(70*R,110)
tl.circle(220*R,25)
tl.circle(-420*R,43)
tl.circle(320*R,65)
tl.circle(55*R,141)
tl.circle(100*R,10)
tl.fd(280*R)
tl.end_fill()

tl.up()
tl.rt(165)
tl.fd(210*R)
tl.lt(20)
tl.down()
tl.begin_fill()
tl.circle(700*R,20)
tl.circle(30*R,120)
tl.circle(800*R,15)
tl.circle(-80*R,30)
tl.circle(-800*R,12)
tl.circle(80*R,70)
tl.circle(500*R,10)
tl.lt(135)
tl.fd(20*R)
tl.lt(42)
tl.circle(-480*R,8)
tl.circle(-70*R,70)
tl.circle(800*R,13)
tl.circle(70*R,30)
tl.circle(-800*R,13)
tl.circle(-25*R,123)
tl.circle(-680*R,17)
tl.end_fill()
tl.up()

tl.lt(80)
tl.fd(200*R)
tl.lt(20)
tl.down()
tl.begin_fill()
tl.circle(-130*R,100)
tl.circle(250*R,20)
tl.circle(-400*R,30)
tl.circle(-250*R,20)
tl.circle(-200*R,35)
tl.rt(90)
tl.fd(20*R)
tl.rt(90)
tl.circle(200*R,35)
tl.circle(230*R,20)
tl.circle(380*R,30)
tl.circle(-260*R,20)
tl.circle(115*R,105)
tl.end_fill()

tl.up()
tl.lt(55)
tl.fd(870*R)
tl.rt(25)
tl.down()
tl.begin_fill()
tl.circle(-400*R,40)
tl.rt(115)
tl.circle(300*R,45)
tl.circle(-700*R,20)
tl.rt(135)
tl.fd(25*R)
tl.rt(43)
tl.circle(700*R,18)
tl.circle(-300*R,39)
tl.lt(113)
tl.circle(400*R,35)
tl.end_fill()
tl.lt(20) 
tl.up ()
tl.fd(300*R)
tl.lt(25)
tl.down()
tl.begin_fill()
tl.circle(-400*R,50)
tl.circle(300*R,5)
tl.lt(170)
tl.circle(-300*R,6)
tl.circle(250*R,25)
tl.circle(400*R,36)
tl.circle(15*R,180)
tl.end_fill()

tl.ht()
tl.done()


效果图
在这里插入图片描述

VC中sqlite的使用 在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示 立即下载

相关推荐

DSSP 工具:蛋白质二级结构信息计算与批量处理教程

DSSP(Dictionary of Secondary Structure in Proteins)是一款经典的蛋白质二级结构计算工具,由荷兰癌症研究所(NKI Research)Perrakis 团队维护。它通过分析蛋白质的 PDB 结构文件,能够自动标注每个氨基酸残基的二级结构类型、相对溶剂可及性(暴露面积)等关键信息,为后续的拓扑图绘制、疏水 / 亲水表面分析、二级结构预测模型训练等提供核心数据支持。

good_rrrrr的博客 1839

绘制“冰墩墩”的Python代码 ← turtle库

Turtle 是 Python 内嵌的绘制线、圆以及其他形状(包括文本)的图形模块。它很容易学习并且使用简单。

hnjzsyjyj的专栏 1137

实战解析:利用Wireshark解密QQ通信协议

本文提供了一份利用Wireshark工具分析QQ通信协议的实战指南。文章详细介绍了从环境准备、捕获数据包到解析协议层的完整流程,重点演示了如何识别QQ号码字段、观察加密数据特征以及区分不同通信类型(如文本、文件传输)。通过此实践,读者可以深入理解网络分层模型和现代应用加密通信机制,提升网络协议分析与安全诊断能力。

weixin_29210727的博客 412

python中使用turtle库画冰墩墩完整代码

python画一个2022奥运会代表物冰墩墩

sjy20050919的博客 958

以太网硬件核心:MAC、PHY、MII与交换机原理与实战排查

计算机网络通信的基础依赖于一套完整的硬件协议栈。在OSI模型中,数据链路层和物理层是实现设备间可靠、高效数据传输的基石。其核心原理在于将上层数据包封装成帧,并通过特定的介质访问控制与物理信号转换机制进行传输。这一过程的技术价值在于为上层应用提供了透明、稳定的通信信道,是互联网和所有局域网通信的物理承载。在嵌入式系统、网络设备开发及运维等应用场景中,深入理解底层硬件交互至关重要。本文将聚焦于以太网硬件的两大核心组件:负责逻辑成帧与流量控制的MAC控制器,以及负责数模转换与链路协商的PHY芯片。它们通过MII、

dgqvhtlwq472235338的博客 424

SOC-ATF 安全启动BL2流程分析(2)

Bl2的启动流程与bl1类似,主要区别是bl2的初始化流程比bl1更简单,但其可能需要加载更多的镜像,如bl31、bl32和bl33。由于bl2可以运行于el3或s-el1,它们的入口函数和处理流程都有所区别,为了简化分析我们选取比较常见的s-el1方式,以下为其总体执行流程:上图仅供参考,实际看一下代码结构:上面截图展示了 链接汇编文件,bl2_el3.ld.S 是指bl2 运行于el3;bl2.ld.S 是实现bl2运行于s-el1 .

z20230508的博客 1389

python绘制冰墩墩的代码

这段代码使用Turtle模块来绘制冰墩墩的形状,包括身体、帽子、眼睛、嘴巴、鼻子和腮红等部分。请注意,这段代码需要在支持图形绘制的Python环境中运行,例如Python的IDLE或Jupyter Notebook。《Python自动化运维》 《Python高级编程第2版》《PYTHON WEB开发学习实录》《Python_Web开发实战》《Python背记手册》《Python编程:从入门到实践 》《Python基础教程(第3版)》《简明Python教程》《Python核心编程》《Python深度学习》

A345545108的博客 1680

基于Simulink的双PMSM差速驱动转矩同步控制建模示例

本文详细介绍了基于Simulink的双永磁同步电机(PMSM)差速驱动转矩同步控制建模方法。针对AGV/叉车等双电机独立驱动系统的转矩不同步问题,提出主从式+交叉耦合控制策略,在Simulink中实现直线行驶、90°转弯和单轮打滑恢复三种工况的仿真验证。通过动力学建模、参数差异设置、同步误差定义及控制律设计,最终实现同步误差<3%、转弯半径跟踪误差<5%、打滑后100ms内恢复的性能指标。文章特别强调了实际工程中的参数标定、通信同步和故障处理要点,并提供了完整的Simulink建模步骤和工具箱使

xiaoheshang_123的博客 206

冰墩墩Python代码

【代码】冰墩墩Python代码。

2301_82347526的博客 705

【调优】OpenClaw从零开始高阶调优之skill篇

本文详细解析了OpenClaw技能系统的核心机制。首先介绍了技能的分层加载逻辑,按照优先级从高到低依次为:工作区专属技能、全局共享技能、出厂自带技能和自定义路径技能。通过流程图展示了从扫描到注册的完整加载流程,并解释了同名技能覆盖规则。随后深入剖析了SKILL.md文件结构,包含YAML元数据定义技能属性和Markdown正文说明使用方法,以公众号写作技能为例展示了具体配置。文章还提供了技能优先级切换的实用技巧,帮助用户灵活管理不同版本的技能。

海兰 240

12、多端神经形态晶体管:原理、应用与算法探索

本文综述了多端神经形态晶体管的原理、应用与算法探索。从神经元MOS晶体管的发展到基于电解质栅极晶体管(EGT)的新型器件设计,系统阐述了其在低电压、多功能逻辑运算和突触行为模拟方面的优势。重点介绍了其在化学生物传感器(如多巴胺和pH检测)中的高灵敏度应用,以及在树突整合、时空总和、动态逻辑和神经元算术等树突算法中的实现。文章还总结了该类器件在神经形态计算、智能传感等领域的广阔前景,并分析了当前面临的材料工艺、理论建模与系统集成挑战,展望了未来发展方向。

delta的博客 144

全网最全的Python教程(非常详细),从零基础入门到上岗!

人工智能的兴起,也给了Python无限可能,让Python越来越火。众所周知人工智能技术已经成为国家战略,而进入人工智能领域,Python是必经之路,Python工程师炙手可热! 腾讯、阿里、百度、网易、谷歌、滴滴等大型互联网企业更是大量使用python开发。这一系列政策和市场迹象都表明,Python确是当下发展的新趋势。

Python84310366的博客 1691

Python爬虫实战:高效爬取CNKI知网文献数据的技术解析

本文将详细介绍如何使用Python最新技术构建一个高效的CNKI知网文献爬虫系统。我们将从爬虫基础知识讲起,逐步深入到高级反反爬技术、分布式爬取、智能解析等前沿内容。文章包含完整的代码实现,涵盖请求模拟、数据解析、持久化存储等关键环节,并特别针对CNKI的反爬机制提供解决方案。通过本文,读者将掌握构建专业级学术文献爬虫的全套技术栈。关键词:Python爬虫、CNKI爬取、反反爬技术、文献数据挖掘、Scrapy框架本文详细介绍了如何使用Python最新技术构建CNKI知网文献爬虫。

2201_76125261的博客 2075

python画冰墩墩代码简易,冰墩墩滑雪的简笔画

参考资料:python中用turtle画一个圆形 https://blog.youkuaiyun.com/SXIAOYAN_/article/details/140061099。大家好,小编在这里要分享,python画冰墩墩代码教程用自动义函数 python画冰墩墩代码文字和五环,现在让我们一起来看看吧!原文地址1:https://blog.youkuaiyun.com/a17348/article/details/136392454。很多人还不知道python画冰墩墩代码简单,现在让我们一起来看看吧!

a159900的博客 297

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

利用Python完美画出冰墩墩附完整源代码

利用Python完美画出冰墩墩附完整源代码

xiangxue666的博客 4371

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

用 Python 与 Turtle 创作属于你的“冰墩墩”!

冰墩墩是2022年北京冬季奥林匹克运动会的官方吉祥物。以熊猫为原型,它象征着中国文化中的和平与友谊,同时也展现了冬季运动的激情和活力。冰墩墩的设计巧妙结合了中国传统文化与现代科技元素,形象深受国内外观众的喜爱。冰墩墩不仅是北京冬奥会的吉祥物,更是中国文化和奥运精神的传播者。它的可爱形象向世界传递了冬季运动的魅力,也成为了众多冰雪运动爱好者和观众的精神陪伴。让我们用代码画出冰墩墩,体验这一奥运文化符号的无限魅力!

qq_43755954的博客 968

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

上一篇: 高中python语言常用语句,高中python例题和答案
下一篇: 用python编写学生管理系统,python编辑学生信息系统
普通网友
博客等级 码龄22年 1万+粉丝 3156原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值