turtle模块练习

前言

最近看到很多人拿turtle去画可爱的皮卡丘,利用傅里叶级数再结合位图可以做出很好看的效果。于是我从上次写的文章,如何利用turtle模块绘制各种图形绘制了一个有意思的图形之后,打算利用turtle模块绘制一个图书馆,浪费时间拍了一些照片,打算来画。困于三维的画图效果没有二维的画图效果轻松,于是花了24个小时绘制了这样一副图形
turtle模块练习_第1张图片

代码

设置背景的颜色

screen = turtle.getscreen()
screen.bgcolor("#2c4772")   #设置程序背景的颜色

turtle模块练习_第2张图片

设置最外面的轮廓

# 1.画出最外边的轮廓
turtle.title("")
turtle.fillcolor("#c2c6ce")     #填充一个方形的区域
turtle.speed(18)
turtle.up()
turtle.goto(-300,-300)
turtle.pd()
turtle.begin_fill()
turtle.left(90)
turtle.pd()
turtle.fd(100)
turtle.right(90)
turtle.fd(600)
turtle.right(90)
turtle.fd(100)
turtle.end_fill()               #结束填充
time.sleep(1)

turtle模块练习_第3张图片

画出里面一层的轮廓

turtle.begin_fill()
turtle.fillcolor("#5c646b")
turtle.fd(75)
turtle.rt(90)
turtle.fd(35)
turtle.rt(90)
turtle.fd(75)
turtle.end_fill()
# time.sleep(2)
for i in range(4):
    turtle.left(90)
    turtle.fd(5)
    turtle.left(90)
    #跟第一个类似
    turtle.begin_fill()
    turtle.fillcolor("#5c646b")
    turtle.fd(75)
    turtle.rt(90)
    turtle.fd(35)
    turtle.rt(90)
    turtle.fd(75)
    turtle.end_fill()
    # time.sleep(1)
# 4.画出右边黑色的小区间
# print(turtle.pos())
turtle.up()
turtle.goto(293,-225)
turtle.pd()
turtle.rt(180)
turtle.begin_fill()
turtle.fillcolor("#5c646b")
turtle.fd(75)
turtle.rt(90)
turtle.fd(35)
turtle.rt(90)
turtle.fd(75)
turtle.end_fill()
for i in range(4):
    turtle.left(90)
    turtle.fd(5)
    turtle.left(90)
    #跟第一个类似
    turtle.begin_fill()
    turtle.fillcolor("#5c646b")
    turtle.fd(75)
    turtle.rt(90)
    turtle.fd(35)
    turtle.rt(90)
    turtle.fd(75)
    turtle.end_fill()
    # time.sleep(1)
print(turtle.pos())
lenZ = 108
time.sleep(10)

turtle模块练习_第4张图片

建筑主体

turtle模块练习_第5张图片

效果图

turtle模块练习_第6张图片

完整代码

import time
import turtle
import pygame
# url = "多远都要在一起.mp3"
# pygame.mixer.init()
# t = pygame.mixer.music.load(url)
# pygame.mixer.music.play()
screen = turtle.getscreen()
screen.bgcolor("#2c4772")   #设置程序背景的颜色
# time.sleep(10)
# 1.画出最外边的轮廓
turtle.title("")
turtle.fillcolor("#c2c6ce")     #填充一个方形的区域
turtle.speed(18)
turtle.up()
turtle.goto(-300,-300)
turtle.pd()
turtle.begin_fill()
turtle.left(90)
turtle.pd()
turtle.fd(100)
turtle.right(90)
turtle.fd(600)
turtle.right(90)
turtle.fd(100)
turtle.end_fill()               #结束填充

# 2.画出里面一层的轮廓
turtle.pencolor("#89898b")
turtle.right(90)
turtle.begin_fill()
turtle.fillcolor("#bcb1aa")
turtle.fd(3)
turtle.right(90)
turtle.fd(90)
print(turtle.pos())
turtle.left(90)
turtle.fd(594)
turtle.left(90)
turtle.fd(90)
turtle.end_fill()
# time.sleep(2)
# 3.画出里面2层左边的轮廓
turtle.pencolor("#4b5157")
turtle.left(90)
turtle.fd(4)
turtle.left(90)
turtle.fd(75)
turtle.rt(90)
turtle.fd(195)
turtle.rt(90)
time.sleep(3)
#
# 填充左边黑色的小区间
turtle.begin_fill()
turtle.fillcolor("#5c646b")
turtle.fd(75)
turtle.rt(90)
turtle.fd(35)
turtle.rt(90)
turtle.fd(75)
turtle.end_fill()
# time.sleep(2)
for i in range(4):
    turtle.left(90)
    turtle.fd(5)
    turtle.left(90)
    #跟第一个类似
    turtle.begin_fill()
    turtle.fillcolor("#5c646b")
    turtle.fd(75)
    turtle.rt(90)
    turtle.fd(35)
    turtle.rt(90)
    turtle.fd(75)
    turtle.end_fill()
    # time.sleep(1)
# 4.画出右边黑色的小区间
# print(turtle.pos())
turtle.up()
turtle.goto(293,-225)
turtle.pd()
turtle.rt(180)
turtle.begin_fill()
turtle.fillcolor("#5c646b")
turtle.fd(75)
turtle.rt(90)
turtle.fd(35)
turtle.rt(90)
turtle.fd(75)
turtle.end_fill()
for i in range(4):
    turtle.left(90)
    turtle.fd(5)
    turtle.left(90)
    #跟第一个类似
    turtle.begin_fill()
    turtle.fillcolor("#5c646b")
    turtle.fd(75)
    turtle.rt(90)
    turtle.fd(35)
    turtle.rt(90)
    turtle.fd(75)
    turtle.end_fill()
    # time.sleep(1)
print(turtle.pos())
lenZ = 108
time.sleep(10)
#5.画出中间的长廊
turtle.up()
turtle.right(180)
turtle.fd(75)
turtle.rt(90)
turtle.fd(4)
print(turtle.pos())
turtle.pd()
turtle.rt(90)
turtle.fd(lenZ)
# time.sleep(3)

#5.1.1画出右边的小墙壁
turtle.begin_fill()
turtle.fillcolor("#969b9c")
turtle.left(90)
turtle.fd(3)
turtle.lt(90)
turtle.fd(lenZ)
turtle.end_fill()

#5.1.2 画出左边的小墙壁
turtle.up()
turtle.rt(90)
turtle.fd(182)
turtle.right(90)
turtle.pd()
turtle.begin_fill()
turtle.fillcolor("#969b9c")
turtle.fd(lenZ)
turtle.left(90)
turtle.fd(3)
turtle.lt(90)
turtle.fd(lenZ)
turtle.end_fill()
# time.sleep(2)

# 5.2 填充中间的颜色
turtle.left(90)
turtle.fd(3)
turtle.left(90)
turtle.fd(lenZ)
turtle.begin_fill()
turtle.fillcolor("#979ea4")
turtle.rt(90)
turtle.fd(182)
turtle.rt(90)
turtle.fd(lenZ)
turtle.rt(90)
turtle.fd(182)
turtle.rt(90)
turtle.fd(lenZ)
turtle.end_fill()
print(turtle.pos())

# 5.3.1 画出里面杂七杂八的东东之一
turtle.rt(180)
turtle.fd(39)
turtle.lt(90)
turtle.begin_fill()
turtle.fillcolor("#5b636a")
turtle.fd(28)
turtle.rt(90)
turtle.fd(69)
turtle.rt(90)
turtle.fd(28)
turtle.rt(90)
turtle.fd(69)
turtle.end_fill()
# time.sleep(5)
# 5.3.1画出杂七杂八东东之二
turtle.up()
turtle.rt(90)
turtle.fd(45)
turtle.rt(90)
turtle.fd(8)
turtle.pd()
turtle.pencolor("black")

turtle.begin_fill()
turtle.fillcolor("#5b636a")
turtle.lt(90)
turtle.fd(100)
turtle.rt(90)
turtle.fd(20)
turtle.rt(90)
turtle.fd(100)
turtle.rt(90)
turtle.fd(20)
turtle.end_fill()
# time.sleep(4)
print(turtle.pos())
# 5.3.1画出杂七杂八东东之三
turtle.up()
turtle.right(90)
turtle.fd(100)
turtle.rt(90)
turtle.fd(61)

turtle.begin_fill()
turtle.fillcolor("#5b636a")
turtle.rt(90)
turtle.fd(105)
turtle.pd()
turtle.rt(90)
turtle.fd(25)
turtle.rt(90)
turtle.fd(105)
turtle.rt(90)
turtle.fd(25)
turtle.end_fill()
# time.sleep(4)
# 5.3.1画出杂七杂八东东之四
turtle.up()
turtle.goto(91,-300)
turtle.right(90)
turtle.begin_fill()
turtle.fillcolor("#5b636a")
turtle.fd(20)
turtle.right(90)
turtle.pd()
turtle.fd(69)
turtle.rt(90)
turtle.fd(20)
turtle.rt(90)
turtle.up()
turtle.fd(69)
turtle.end_fill()
# time.sleep(3)
turtle.rt(180)
turtle.fd(108)
x,y = turtle.pos()#右顶点处的坐标
print(x,y)
print(turtle.pos())
tstamp1 = turtle.stamp()
time.sleep(4)

# 5.4.绘制出小屋顶
turtle.pd()
turtle.color("black")
turtle.begin_fill()
turtle.fillcolor("#658292")
turtle.rt(90)
turtle.fd(10)
turtle.lt(60)
turtle.fd(16)
turtle.lt(120)
turtle.up()
turtle.fd(218)#之间瞎写的一个220,经过计算得到是224
turtle.pd()
print(turtle.pos())
turtle.lt(120)
turtle.fd(16)
print("目标",turtle.pos())
turtle.lt(60)
turtle.fd(202)
turtle.end_fill()
# turtle.hideturtle()
# time.sleep(4)
# time.sleep(3)

# 5.4.绘制出小屋顶2
turtle.setpos(x,y)
# time.sleep(3)
turtle.fd(10)
turtle.lt(60)
turtle.fd(16)
turtle.left(30)
turtle.begin_fill()
turtle.fillcolor("#5b636a")
turtle.fd(10)
turtle.lt(90)
turtle.fd(218)
turtle.lt(90)
turtle.fd(10)
turtle.lt(90)
turtle.fd(218)
turtle.end_fill()
# time.sleep(4)


#6.1 画出右边第一层粉红的图形
turtle.begin_fill()
turtle.fillcolor("#cd9699")
x2,y2 = turtle.pos()
turtle.lt(90)
turtle.fd(10)
turtle.rt(90)
turtle.fd(15)
turtle.rt(90)
turtle.goto(124,-210)#这里不会是30
turtle.rt(90)
turtle.goto(94,-210)
turtle.rt(90)
turtle.goto(94,-192)
turtle.rt(90)
turtle.fd(7)
turtle.lt(60)
turtle.fd(16)
turtle.end_fill()
# time.sleep(4)
#6.2 画出右边第一层红的图形
turtle.lt(30)
turtle.fd(10)
turtle.rt(90)
turtle.fd(15)
turtle.begin_fill()
turtle.fillcolor("#9a6051")
x1,y1 = turtle.pos()
turtle.fd(30)
x3,y3 = turtle.pos()    #用于描白边
turtle.rt(90)
turtle.goto(154,-210)
turtle.rt(90)
turtle.goto(124,-210)
turtle.rt(90)
turtle.goto(x1,y1)
turtle.end_fill()
# time.sleep(10)
#7.1 画出左边第一层粉红的图形
turtle.up()
turtle.goto(-x2,y2)
# time.sleep(10)

turtle.begin_fill()
turtle.fillcolor("#cd9699")
turtle.pd()
turtle.fd(10)
turtle.lt(90)
turtle.fd(15)
turtle.lt(90)
turtle.goto(-124,-210)#这里不会是30
turtle.lt(90)
turtle.goto(-94,-210)
turtle.lt(90)
turtle.goto(-94,-192)
turtle.lt(90)
turtle.fd(7)
turtle.rt(60)
turtle.fd(16)
turtle.end_fill()
# time.sleep(4)

#6.2 画出左边第一层红的图形
turtle.rt(30)
turtle.fd(10)
turtle.lt(90)
turtle.fd(15)
turtle.begin_fill()
turtle.fillcolor("#9a6051")
# x1,y1 = turtle.pos()
turtle.fd(30)
turtle.lt(90)
turtle.goto(-154,-210)
turtle.lt(90)
turtle.goto(-124,-210)
turtle.lt(90)
turtle.goto(-x1,y1)
turtle.end_fill()
# time.sleep(10)
# 7.1画出第一个描边
turtle.rt(90)
turtle.goto(x3,y3)
turtle.pencolor("white")
turtle.begin_fill()
turtle.fillcolor("white")
turtle.lt(90)
turtle.fd(4)
turtle.lt(90)
turtle.goto(-x3,y3+4)
turtle.lt(90)
turtle.goto(-x3,y3)
turtle.lt(90)
turtle.goto(x3,y3)
turtle.end_fill()
turtle.pencolor("black")
# time.sleep(5)
# 8.1画出右边的最右边的红色方块
turtle.lt(90)
turtle.fd(4)
x4,y4 = turtle.pos()
turtle.begin_fill()
turtle.fillcolor("#9a6051")
turtle.fd(30)
turtle.lt(90)
turtle.fd(30)
turtle.lt(90)
turtle.fd(30)
turtle.lt(90)
turtle.fd(30)
turtle.end_fill()
# time.sleep(5)
x5 = 0
y5 = 0
turtle.lt(90)
turtle.fd(33)
turtle.begin_fill()
turtle.fillcolor("#9b959c")
turtle.lt(90)
turtle.fd(30)
turtle.lt(90)
turtle.fd(3)
turtle.lt(90)
turtle.goto(x4,y4+30)
turtle.end_fill()
# y5 = y5+33
# time.sleep(5)

#第二个,第三个,第四个
for i in range(2):
    turtle.lt(90)
    turtle.fd(3)
    x5,y5 = turtle.pos()
    turtle.begin_fill()
    turtle.fillcolor("#9a6051")
    turtle.fd(30)
    turtle.lt(90)
    turtle.fd(30)
    turtle.lt(90)
    turtle.fd(30)
    turtle.lt(90)
    turtle.fd(30)
    turtle.end_fill()

    turtle.lt(90)
    turtle.fd(33)
    turtle.begin_fill()
    turtle.fillcolor("#9b959c")
    turtle.lt(90)
    turtle.fd(30)
    turtle.lt(90)
    turtle.fd(3)
    turtle.lt(90)
    turtle.goto(x5, y5 + 30)
    turtle.end_fill()
# time.sleep(4)
# 8.1.1 画出右边的最右边最上面的红色方块
turtle.lt(90)
turtle.fd(3)
turtle.begin_fill()
turtle.fillcolor("#9a6051")
turtle.fd(40)
turtle.lt(90)
turtle.fd(30)
turtle.lt(90)
turtle.fd(40)
turtle.lt(90)
turtle.fd(30)
turtle.end_fill()
# time.sleep(10)

# 8.1.2 画出右边的中间的粉红色的部分
turtle.up()
turtle.goto(x4 - 30, y4)
turtle.pd()
turtle.lt(90)
turtle.begin_fill()
turtle.fillcolor("#cd9699")
turtle.fd(26)
turtle.lt(90)
turtle.fd(54)
turtle.lt(90)
turtle.fd(26)
turtle.lt(90)
turtle.fd(54)
turtle.end_fill()

turtle.lt(90)
turtle.fd(26)
turtle.begin_fill()
turtle.fillcolor("#c9ced4")
turtle.fd(7)
turtle.lt(90)
turtle.fd(54)
turtle.lt(90)
turtle.fd(7)
turtle.lt(90)
turtle.fd(54)
turtle.end_fill()
for i in range(2):
    turtle.lt(90)
    turtle.fd(7)
    turtle.begin_fill()
    turtle.fillcolor("#cd9699")
    turtle.fd(26)
    turtle.lt(90)
    turtle.fd(54)
    turtle.lt(90)
    turtle.fd(26)
    turtle.lt(90)
    turtle.fd(54)
    turtle.end_fill()

    turtle.lt(90)
    turtle.fd(26)
    turtle.begin_fill()
    turtle.fillcolor("#c9ced4")
    turtle.fd(7)
    turtle.lt(90)
    turtle.fd(54)
    turtle.lt(90)
    turtle.fd(7)
    turtle.lt(90)
    turtle.fd(54)
    turtle.end_fill()
# time.sleep(10)
turtle.lt(90)
turtle.fd(7)
turtle.begin_fill()
turtle.fillcolor("#cd9699")
turtle.fd(40)
turtle.lt(90)
turtle.fd(54)
turtle.lt(90)
turtle.fd(40)
turtle.lt(90)
turtle.fd(54)
turtle.end_fill()
# time.sleep(10)

# 8.3画出右边的左边的红色部分
turtle.up()
turtle.setpos(x4-84,y4)
# time.sleep(10)
turtle.pd()
turtle.left(90)
turtle.begin_fill()
turtle.fillcolor("#9a6051")
turtle.fd(30)
turtle.lt(90)
turtle.fd(10)
turtle.lt(90)
turtle.fd(30)
turtle.lt(90)
turtle.fd(10)
turtle.end_fill()

turtle.lt(90)
turtle.begin_fill()
turtle.fillcolor("#ccc2c4")
turtle.fd(30)
turtle.fd(3)
turtle.lt(90)
turtle.fd(10)
turtle.lt(90)
turtle.fd(3)
turtle.lt(90)
turtle.fd(10)
turtle.end_fill()
for i in range(2):
    turtle.lt(90)
    turtle.fd(3)
    turtle.begin_fill()
    turtle.fillcolor("#9a6051")
    turtle.fd(30)
    turtle.lt(90)
    turtle.fd(10)
    turtle.lt(90)
    turtle.fd(30)
    turtle.lt(90)
    turtle.fd(10)
    turtle.end_fill()

    turtle.lt(90)
    turtle.fd(30)
    turtle.begin_fill()
    turtle.fillcolor("#ccc2c4")
    turtle.fd(3)
    turtle.lt(90)
    turtle.fd(10)
    turtle.lt(90)
    turtle.fd(3)
    turtle.lt(90)
    turtle.fd(10)
    turtle.end_fill()
# time.sleep(10)
turtle.lt(90)
turtle.fd(3)
turtle.begin_fill()
turtle.fillcolor("#9a6051")
turtle.fd(40)
turtle.lt(90)
turtle.fd(10)
turtle.lt(90)
turtle.fd(40)
turtle.lt(90)
turtle.fd(10)
turtle.end_fill()
# time.sleep(10)

#根据对称性,左边的可以表示为
# 8.1画出右边的最右边的红色方块
turtle.lt(90)
turtle.fd(4)
# x4,y4 = turtle.pos()
turtle.up()
turtle.setpos(-x4,y4)
turtle.pd()
turtle.begin_fill()
turtle.fillcolor("#9a6051")
turtle.fd(30)
turtle.rt(90)
turtle.fd(30)
turtle.rt(90)
turtle.fd(30)
turtle.rt(90)
turtle.fd(30)
turtle.end_fill()
# time.sleep(5)
x5 = 0
y5 = 0
turtle.rt(90)
turtle.fd(33)
turtle.begin_fill()
turtle.fillcolor("#9b959c")
turtle.rt(90)
turtle.fd(30)
turtle.rt(90)
turtle.fd(3)
turtle.rt(90)
turtle.goto(-x4,y4+30)
turtle.end_fill()
# y5 = y5+33
# time.sleep(5)

#第二个,第三个,第四个
for i in range(2):
    turtle.rt(90)
    turtle.fd(3)
    x5,y5 = turtle.pos()
    turtle.begin_fill()
    turtle.fillcolor("#9a6051")
    turtle.fd(30)
    turtle.rt(90)
    turtle.fd(30)
    turtle.rt(90)
    turtle.fd(30)
    turtle.rt(90)
    turtle.fd(30)
    turtle.end_fill()

    turtle.rt(90)
    turtle.fd(33)
    turtle.begin_fill()
    turtle.fillcolor("#9b959c")
    turtle.rt(90)
    turtle.fd(30)
    turtle.rt(90)
    turtle.fd(3)
    turtle.rt(90)
    turtle.goto(x5, y5 + 30)
    turtle.end_fill()
# time.sleep(4)
# 8.1.1 画出右边的最右边最上面的红色方块
turtle.rt(90)
turtle.fd(3)
turtle.begin_fill()
turtle.fillcolor("#9a6051")
turtle.fd(40)
turtle.rt(90)
turtle.fd(30)
turtle.rt(90)
turtle.fd(40)
turtle.rt(90)
turtle.fd(30)
turtle.end_fill()
# time.sleep(10)

# 8.1.2 画出右边的中间的粉红色的部分
turtle.up()
turtle.goto(-x4 + 30, y4)
turtle.pd()
turtle.rt(90)
turtle.begin_fill()
turtle.fillcolor("#cd9699")
turtle.fd(26)
turtle.rt(90)
turtle.fd(54)
turtle.rt(90)
turtle.fd(26)
turtle.rt(90)
turtle.fd(54)
turtle.end_fill()

turtle.rt(90)
turtle.fd(26)
turtle.begin_fill()
turtle.fillcolor("#c9ced4")
turtle.fd(7)
turtle.rt(90)
turtle.fd(54)
turtle.rt(90)
turtle.fd(7)
turtle.rt(90)
turtle.fd(54)
turtle.end_fill()
for i in range(2):
    turtle.rt(90)
    turtle.fd(7)
    turtle.begin_fill()
    turtle.fillcolor("#cd9699")
    turtle.fd(26)
    turtle.rt(90)
    turtle.fd(54)
    turtle.rt(90)
    turtle.fd(26)
    turtle.rt(90)
    turtle.fd(54)
    turtle.end_fill()

    turtle.rt(90)
    turtle.fd(26)
    turtle.begin_fill()
    turtle.fillcolor("#c9ced4")
    turtle.fd(7)
    turtle.rt(90)
    turtle.fd(54)
    turtle.rt(90)
    turtle.fd(7)
    turtle.rt(90)
    turtle.fd(54)
    turtle.end_fill()
# time.sleep(10)
turtle.rt(90)
turtle.fd(7)
turtle.begin_fill()
turtle.fillcolor("#cd9699")
turtle.fd(40)
turtle.rt(90)
turtle.fd(54)
turtle.rt(90)
turtle.fd(40)
turtle.rt(90)
turtle.fd(54)
turtle.end_fill()
# time.sleep(10)

# 8.3画出右边的左边的红色部分
turtle.up()
turtle.setpos(-x4+84,y4)
# time.sleep(10)
turtle.pd()
turtle.rt(90)
turtle.begin_fill()
turtle.fillcolor("#9a6051")
turtle.fd(30)
turtle.rt(90)
turtle.fd(10)
turtle.rt(90)
turtle.fd(30)
turtle.rt(90)
turtle.fd(10)
turtle.end_fill()

turtle.rt(90)
turtle.begin_fill()
turtle.fillcolor("#ccc2c4")
turtle.fd(30)
turtle.fd(3)
turtle.rt(90)
turtle.fd(10)
turtle.rt(90)
turtle.fd(3)
turtle.rt(90)
turtle.fd(10)
turtle.end_fill()
for i in range(2):
    turtle.rt(90)
    turtle.fd(3)
    turtle.begin_fill()
    turtle.fillcolor("#9a6051")
    turtle.fd(30)
    turtle.rt(90)
    turtle.fd(10)
    turtle.rt(90)
    turtle.fd(30)
    turtle.rt(90)
    turtle.fd(10)
    turtle.end_fill()

    turtle.rt(90)
    turtle.fd(30)
    turtle.begin_fill()
    turtle.fillcolor("#ccc2c4")
    turtle.fd(3)
    turtle.rt(90)
    turtle.fd(10)
    turtle.rt(90)
    turtle.fd(3)
    turtle.rt(90)
    turtle.fd(10)
    turtle.end_fill()
# time.sleep(10)
turtle.rt(90)
turtle.fd(3)
turtle.begin_fill()
turtle.fillcolor("#9a6051")
turtle.fd(40)
turtle.rt(90)
turtle.fd(10)
turtle.rt(90)
turtle.fd(40)
turtle.rt(90)
turtle.fd(10)
turtle.end_fill()
# time.sleep(10)

# 9.绘制中间的顶梁柱
turtle.up()
turtle.setpos(-x4+94,y4)
# time.sleep(10)
turtle.rt(90)
turtle.pd()
turtle.begin_fill()
turtle.fillcolor("#3d4d62")
turtle.fd(180)
turtle.rt(90)
turtle.fd(10)
turtle.rt(90)
turtle.fd(60)
turtle.lt(90)
turtle.fd(100)#####
turtle.lt(90)
turtle.fd(60)
turtle.rt(90)
turtle.fd(10)
turtle.rt(90)
turtle.fd(180)###
turtle.rt(90)
turtle.fd(10)
turtle.rt(90)
turtle.fd(110)
turtle.lt(90)
turtle.fd(100)###
turtle.lt(90)
turtle.fd(110)
turtle.rt(90)
turtle.fd(10)
turtle.end_fill()
# time.sleep(10)

#绘制最中间的部分
turtle.rt(180)
turtle.fd(10)
turtle.begin_fill()
turtle.fillcolor("#9a9da5")
turtle.fd(100)
turtle.lt(90)
turtle.fd(110)
turtle.lt(90)
turtle.fd(100)
turtle.lt(90)
turtle.fd(110)
turtle.end_fill()
# time.sleep(10)

# 把窗口分成三个
for i in range(3):
    turtle.rt(180)
    turtle.begin_fill()
    turtle.fillcolor("#627178")
    turtle.fd(33)
    turtle.rt(90)
    turtle.fd(100)
    turtle.lt(90)#
    turtle.fd(5)
    turtle.lt(90)#
    turtle.fd(100)
    turtle.lt(90)
    turtle.fd(5)
    turtle.end_fill()
# time.sleep(10)

turtle.up()
turtle.setpos(-x4,y4+139)
turtle.pd()
# time.sleep(10)

turtle.lt(90)
turtle.fd(20)
xe,ye = turtle.pos()
turtle.begin_fill()
turtle.fillcolor("#6c6366")
turtle.lt(120)
turtle.fd(60)
turtle.rt(120)
turtle.fd(320)##之前是200
turtle.rt(120)###之前是lt
turtle.fd(60)
turtle.rt(60)##之前是lt
turtle.fd(7)
turtle.rt(120)
turtle.fd(50)
turtle.lt(120)
turtle.fd(295)
turtle.lt(120)
turtle.fd(50)
turtle.rt(120)
turtle.goto(xe,ye)
turtle.end_fill()
# time.sleep(10)

# turtle.up()
turtle.setpos(xe,ye)
# time.sleep(10)
turtle.rt(60)
turtle.fd(60)
turtle.rt(120)
turtle.fd(70)
##绘制最高角
x7,y7 = turtle.pos()
# time.sleep(10)
turtle.begin_fill()
turtle.fillcolor("#996156")
turtle.lt(90)
turtle.fd(20)
turtle.rt(30)
turtle.fd(40)
turtle.rt(60)
turtle.fd(15)
turtle.lt(90)
x8,y8 = turtle.pos()
turtle.goto(x7+35,y7)
turtle.lt(90)
turtle.goto(x7,y7)
turtle.end_fill()
# time.sleep(10)

turtle.rt(180)
turtle.goto(x8+110,y7)
turtle.lt(90)
turtle.begin_fill()
turtle.fillcolor("#996156")
turtle.goto(x8+110,y8)
turtle.rt(90)
turtle.fd(15)
turtle.rt(60)
turtle.fd(40)
turtle.rt(30)
turtle.fd(20)
turtle.rt(90)
turtle.goto(x8+110,y7)
turtle.end_fill()
time.sleep(10)

school = "xx学院通"
major = "——XXXXXX专业"

turtle.up()                 #设置箭头在移动的时候不画线
turtle.setpos(0,300)
# time.sleep(10)
# turtle.left(90)
# turtle.fd(300)
turtle.pencolor("white")    #设置字体的颜色
# turtle.left(90)             #调一下头
turtle.fd(200)              #往左边走200像素
turtle.right(180)           #再掉一次头
#写学校名字的算法
for i in school:
    turtle.write(i,False,align = "right",font = ("幼圆",30,"bold"))
    turtle.fd(40)
    turtle.delay(100)
turtle.speed(10)
#将光标定位到下一行
turtle.setpos(-180,200)
turtle.speed(5)
#写专业的名字的算法
for i in major:
    turtle.write(i,False,align = "right",font = ("华文楷体",40,"bold"))
    turtle.fd(50)
    turtle.delay(50)
# 绘制长沙理工大学图书馆图标
time.sleep(3)
turtle.reset()
turtle.done()

你可能感兴趣的:(python机器学习,python,开发语言)