Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3658370
  • 博文数量: 365
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2522
  • 用 户 组: 普通用户
  • 注册时间: 2019-10-28 13:40
文章分类

全部博文(365)

文章存档

2023年(8)

2022年(130)

2021年(155)

2020年(50)

2019年(22)

我的朋友

分类: Python/Ruby

2022-09-01 11:50:53

import turtle

import math

turtle.title("照彻乾坤,印透山河")

turtle.bgpic("yueliang/1.png")

p = turtle.Turtle()

p.pensize(4)

p.speed(3)

#做月饼的面

def ellipse(a,b,n=500,c='#CD950C'):

    p.penup()

    p.setpos(a,0)

    color = p.color(c)

    p.pendown()

    for i in range(n):

        radian = 2 * math.pi /n

        theta = (i+1) * radian

        next_point =跟单网gendan5.com (a * math.cos(theta)),b * math.sin(theta)

        p.setpos(next_point)

ellipse(300,200,c='#CD950C')

ellipse(296,196,c='#FFB90F')

ellipse(292,192,c='#FFD700')

#做月饼的底

turtle.penup()

turtle.goto(-10,-300)

turtle.color("#CD950C")

turtle.pensize(6)

turtle.pendown()

turtle.circle(430,42)#33

turtle.circle(420,-84)#-60

turtle.goto(-296,-40)

turtle.penup()

turtle.goto(296,-40)

turtle.pendown()

turtle.right(54)

turtle.forward(151)

turtle.penup()

turtle.goto(0,0)

turtle.pendown()

def draw(a1,b1,a2,b2,f='#CD950C'):#边角的2个点,分别是(a1,b1),(a2,b2)

    turtle.penup()

    turtle.goto(a1,b1)

    turtle.pensize(6)

    turtle.color(f)

    turtle.pendown()

    turtle.goto(a2,b1)

    turtle.goto(a2,b2)

    turtle.penup()

    return()

#下面是4个角图案

draw(260,78,130,170,'#FFD700')

draw(250,90,150,160)

draw(240,102,172,150)

draw(230,114,194,140)

draw(-260,-78,-130,-170,'#FFD700')

draw(-250,-90,-150,-160)

draw(-240,-102,-172,-150)

draw(-230,-114,-194,-140)

draw(260,-78,130,-170,'#FFD700')

draw(250,-90,150,-160)

draw(240,-102,172,-150)

draw(230,-114,194,-140)

draw(-262,78,-130,170,'#FFD700')

draw(-250,90,-150,160)

draw(-240,102,-172,150)

draw(-230,114,-194,140)

turtle.penup()

turtle.pensize(6)

turtle.color("#CD950C")

turtle.goto(-270,66)

turtle.pendown()

turtle.goto(-150,66)

turtle.goto(-150,-66)

turtle.goto(-270,-66)

turtle.goto(-270,-54)

turtle.goto(-170,-54)

turtle.goto(-170,54)

turtle.goto(-276,54)

turtle.goto(-276,42)

turtle.goto(-190,42)

turtle.goto(-190,-42)

turtle.goto(-276,-42)

turtle.goto(-276,-30)

turtle.goto(-210,-30)

turtle.goto(-210,30)

turtle.goto(-279,30)

turtle.goto(-279,18)

turtle.goto(-230,18)

turtle.goto(-230,-18)

turtle.goto(-282,-18)

turtle.goto(-282,-2)

turtle.goto(-258,-2)

turtle.penup()

turtle.penup()

turtle.goto(-128,-2)

turtle.pendown()

turtle.color("#FFD700")

turtle.pensize(2)

turtle.goto(126,-2)

turtle.penup()

turtle.penup()

turtle.pensize(6)

turtle.color("#CD950C")

turtle.goto(270,66)

turtle.pendown()

turtle.goto(150,66)

turtle.goto(150,-66)

turtle.goto(270,-66)

turtle.goto(270,-54)

turtle.goto(170,-54)

turtle.goto(170,54)

turtle.goto(276,54)

turtle.goto(276,42)

turtle.goto(190,42)

turtle.goto(190,-42)

turtle.goto(276,-42)

turtle.goto(276,-30)

turtle.goto(210,-30)

turtle.goto(210,30)

turtle.goto(279,30)

turtle.goto(279,18)

turtle.goto(230,18)

turtle.goto(230,-18)

turtle.goto(282,-18)

turtle.goto(282,-2)

turtle.goto(258,-2)

turtle.penup()

turtle.penup()

turtle.pensize(6)

turtle.color("#CD950C")

turtle.goto(-110,174)

turtle.pendown()

turtle.goto(-110,90)

turtle.goto(110,90)

turtle.goto(110,174)

turtle.goto(90,174)

turtle.goto(90,102)

turtle.goto(-90,102)

turtle.goto(-90,176)

turtle.goto(-70,176)

turtle.goto(-70,114)

turtle.goto(70,114)

turtle.goto(70,176)

turtle.goto(50,176)

turtle.goto(50,126)

turtle.goto(-50,126)

turtle.goto(-50,180)

turtle.goto(-30,180)

turtle.goto(-30,138)

turtle.goto(30,138)

turtle.goto(30,182)

turtle.goto(10,182)

turtle.goto(-10,182)

turtle.goto(-10,150)

turtle.goto(10,150)

turtle.goto(10,166)

turtle.penup()

turtle.penup()

turtle.goto(10,76)

turtle.pendown()

turtle.pensize(2)

turtle.color("#FFD700")

turtle.goto(10,-75)

turtle.penup()

turtle.penup()

turtle.pensize(6)

turtle.color("#CD950C")

turtle.goto(-110,-174)

turtle.pendown()

turtle.goto(-110,-90)

turtle.goto(110,-90)

turtle.goto(110,-174)

turtle.goto(90,-174)

turtle.goto(90,-102)

turtle.goto(-90,-102)

turtle.goto(-90,-176)

turtle.goto(-70,-176)

turtle.goto(-70,-114)

turtle.goto(70,-114)

turtle.goto(70,-176)

turtle.goto(50,-176)

turtle.goto(50,-126)

turtle.goto(-50,-126)

turtle.goto(-50,-180)

turtle.goto(-30,-180)

turtle.goto(-30,-138)

turtle.goto(30,-138)

turtle.goto(30,-182)

turtle.goto(10,-182)

turtle.goto(-10,-182)

turtle.goto(-10,-150)

turtle.goto(10,-150)

turtle.goto(10,-166)

turtle.penup()

#中间金色边框

turtle.penup()

turtle.goto(-130,170)

draw(-130,78,130,-78,'#FFD700')

draw(130,-78,-130,78,'#FFD700')

turtle.penup()

#中间金色字体

turtle.penup()

turtle.speed(1)

turtle.penup()

turtle.goto(-100,0)

turtle.pendown()

turtle.color('#D2691E')

turtle.write("",font=("隶书",60,"bold"))

turtle.penup()

turtle.goto(30,0)

turtle.pendown()

turtle.write("",font=("隶书",60,"bold"))

turtle.penup()

turtle.goto(-100,-80)

turtle.pendown()

turtle.write("",font=("隶书",60,"bold"))

turtle.penup()

turtle.goto(30,-80)

turtle.pendown()

turtle.write("",font=("隶书",60,"bold"))

turtle.penup()

p.hideturtle()

turtle.mainloop()

阅读(456) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~