猫史档案馆


【Python作品分享】北京地铁线路图【作品秀】

用户:杨之文杨之文查看:0 回复:1 评论:0 创建时间:2022-12-22T16:30:31


【作品展示】

center_image

 

【作品介绍】

本作者近期绘制了北京地铁的线路图。创作不易,更新至2011年,若您有兴趣,请加入我们北京地铁工作室!

 

【作品源代码】

import turtle

q = turtle.Pen()
q.pensize(3)
q.speed(0)

def qian(can):
    q.forward(can)
def zuo(can):
    q.left(90)
    q.forward(can)
def hou(can):
    q.backward(can)
def you(can):
    q.right(90)
    q.forward(can)
def luo():
    q.pendown()
def tai():
    q.penup()

# 1969
tai()
q.pencolor('red')
hou(250)
luo()
qian(200)
you(25)
zuo(200)
zuo(12.5)
hou(12.5)
zuo(200)
you(25)
zuo(200)
# 1971
qian(100)
q.right(45)
qian(25)
hou(25)
q.right(135)
qian(300)
# 1984
q.pencolor('blue')
zuo(100)
you(200)
you(100)
# 1987
qian(25)
you(200)
you(25)
# 1992
q.pencolor('red')
you(50)
tai()
qian(50)
# 1999
luo()
qian(250)
# 2000
hou(300)
hou(50)
tai()
q.pencolor("yellow")
# 2002
zuo(100)
q.left(45)
luo()
qian(15)
q.right(45)
qian(150)
you(110)
# 2003(13)
qian(110)
you(150)
q.right(45)
qian(15)
tai()
q.left(45)
# 2003(bt)
qian(100)
zuo(150)
q.pencolor("red")
luo()
qian(200)
q.right(45)
qian(150)
hou(150)
q.right(135)
qian(380)
# 2007
tai()
q.pencolor("pink")
you(320)
luo()
hou(500)
tai()
qian(350)
q.pencolor("skyblue")
# 2008(10)
luo()
zuo(300)
hou(400)
zuo(250)
hou(250)
you(150)
# 2008(8)
q.pencolor("green")
you(30)
hou(30)
tai()
you(90)
# 2008(jc)
q.pencolor("gray")
you(60)
q.right(45)
qian(15)
q.left(165)
luo()
qian(80)
q.right(15)
qian(200)
q.left(50)
qian(100)
hou(25)
zuo(60)
you(25)
hou(25)
q.left(15)
hou(105)
tai()
qian(105)
q.right(105)
qian(60)
you(75)
q.right(50)
qian(200)
q.left(15)
qian(80)
q.right(30)
qian(200)
# 2009
q.pencolor("green1")
zuo(5)
you(75)
you(150)
zuo(100)
luo()
zuo(0)
zuo(100)
you(150)
zuo(100)
you(285)
# 2010(dx)
q.right(45)
qian(25)
q.left(45)
qian(150)
hou(150)
q.right(45)
q.right(180)
qian(25)
q.left(45)
qian(10)
tai()
# 2010(yz)
you(146)
luo()
q.pencolor("pink3")
you(25)
q.left(45)
qian(125)
q.left(45)
qian(125)
hou(125)
q.right(45)
hou(125)
q.right(45+180)
tai()
qian(25+375)
# 2010(15)
q.pencolor("purple")
you(40)
luo()
qian(125)
zuo(200)
hou(200)
zuo(125)
tai()
qian(220)
# 2010(cp)
q.pencolor("pink2")
you(65)
luo()
qian(25)
q.right(45)
qian(25)
q.left(45)
qian(75)
hou(75)
q.right(45+180)
qian(25)
q.left(45)
qian(25)
tai()
qian(150)
q.left(45)
qian(15)
q.right(45)
qian(5)
you(77)
zuo(145)
q.right(45)
qian(120)
q.left(45)
qian(100)
# 2010(fs)
q.pencolor("orange")
q.right(45)
qian(25)
luo()
qian(150)
q.right(45)
qian(100)
hou(100)
q.left(45+180)
qian(150)
# 2011(fs)
qian(25)
q.left(45)
# 2010(9)
q.pencolor("green2")
qian(100)
q.right(45)
qian(120)
q.left(45)
qian(25)
tai()
you(277)
zuo(125)
q.right(45)
qian(15)
q.left(45)
# 2011(15)
q.pencolor("purple")
qian(85)
luo()
you(125)
zuo(200)
you(250)
q.hideturtle()

turtle.done()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
北京_地铁迷北京_地铁迷

《 1 0 版 线 路 图 》

点赞0


评论