用户:
空间魔法师查看:0 回复:1 评论:0 创建时间:2021-05-09T00:57:43
【作品展示】

【作品介绍】
我利用海龟库及其功能绘制了一个外太空的场景:宇航员,地球,陨石,太阳,星系等,这些宇宙建筑表达我对理想的美好憧憬……同时母亲节来临,我想把“得意之作”送给妈妈,祝愿妈妈工作顺利,永远快乐!我也一定不辜负妈妈的期望,努力学习,长大成为对社会有用的人!
【作品源代码】
import turtle
t=turtle.Pen()
t.speed(0)
t.pencolor("white")
t.pensize(3)
turtle.bgcolor('black')
# 定义小星星
def star_喵all(a,b,c):
t.penup()
t.goto(a,b)
t.dot(c)
t.pendown()
# 定义大星星
def star_big(a,b,c):
t.goto(a,b)
t.dot(c)
# 巨蟹星座图
star_喵all(80,200,15)
star_big(110,120,15)
star_big(140,80,15)
star_big(220,0,15)
star_喵all(50,-40,15)
star_big(140,80,15)
t.penup()
# 宇航员头盔
t.goto(-200, 200)
t.dot(130)
t.pencolor("gray")
t.dot(110)
t.goto(-180, 230)
t.pencolor("lightblue")
t.dot(25)
t.goto(-185, 200)
t.dot(20)
# 面料
t.goto((-250), 135)
t.fillcolor("lightblue")
t.begin_fill()
t.pendown()
t.goto(-150, 135)
t.goto(-150, 20)
t.goto(-250, 20)
t.goto(-250, 135)
t.end_fill()
# 拉链
t.penup()
t.pendown()
t.begin_fill()
t.fillcolor("gray")
t.goto(-205, 135)
t.goto(-195, 135)
t.goto(-195, 20)
t.goto(-205, 20)
t.goto(-205, 135)
t.end_fill()
t.penup()
#手臂
t.goto(-250, 110)
t.pendown()
t.pensize(20)
t.pencolor("lightblue")
t.goto(-310, 140)
t.pencolor("tan")
t.dot(25)
t.penup()
t.goto(-150, 110)
t.pendown()
t.pensize(20)
t.pencolor("lightblue")
t.goto(-90, 80)
t.pencolor("tan")
t.dot(25)
#裤子
t.penup()
t.pensize(1)
t.goto(-250, 20)
t.pencolor("black")
t.pendown()
t.fillcolor("lightblue")
t.begin_fill()
t.goto(-150, 20)
t.goto(-150, -70)
t.goto(-250, -70)
t.goto(-250, 20)
t.end_fill()
#鞋
t.pencolor("gray")
t.penup()
t.goto(-210, -70)
t.pensize(20)
t.pendown()
t.goto(-260, -70)
t.goto(-190, -70)
t.pensize(20)
t.pendown()
t.goto(-140, -70)
t.pensize(1)
t.pencolor("black")
t.penup()
t.goto(-200, 20)
t.pendown()
t.goto(-200, -90)
#氧气管
t.pencolor("white")
t.pensize(10)
t.penup()
t.goto(-135, 200)
t.pendown()
t.goto(-85, 200)
t.goto(-150, 57)
# 星座标注
t.pencolor("lightblue")
t.penup()
t.goto(-20,50)
t.pendown()
t.write("巨蟹座",font=('Arial',30))
# 地球
t.fillcolor("blue")
t.begin_fill()
t.penup()
t.goto(480,100)
t.pendown()
t.circle(150)
t.end_fill()
# 亚洲
t.penup()
t.goto(570,360)
t.pendown()
t.color("green")
t.fillcolor("lightgreen")
t.begin_fill()
t.left(180)
t.forward(180)
t.left(130)
t.forward(130)
t.left(93)
t.forward(138)
t.end_fill()
# 欧洲
t.penup()
t.goto(390,360)
t.pendown()
t.begin_fill()
t.left(195)
t.forward(70)
t.left(120)
t.forward(80)
t.end_fill()
# 非洲
t.begin_fill()
t.right(110)
t.forward(100)
t.right(133)
t.forward(102)
t.end_fill()
# 大洋洲
t.penup()
t.goto(450,230)
t.pendown()
t.right(115)
t.begin_fill()
for i in range(4):
t.forward(60)
t.right(90)
t.end_fill()
# 南极洲
t.pencolor("white")
t.fillcolor("white")
t.begin_fill()
t.penup()
t.goto(400,135)
t.pendown()
t.left(90)
t.forward(16)
t.right(90)
t.forward(160)
t.right(90)
t.forward(16)
t.right(90)
t.forward(160)
t.end_fill()
# 绘制陨石1
t.pencolor("gray")
t.fillcolor("gray")
t.begin_fill()
t.penup()
t.goto(480, -100)
t.pendown()
t.circle(80)
t.end_fill()
t.pencolor("white")
t.fillcolor("white")
t.begin_fill()
t.penup()
t.goto(500, -130)
t.pendown()
t.circle(20)
t.end_fill()
t.begin_fill()
t.penup()
t.goto(450, -190)
t.pendown()
t.circle(20)
t.end_fill()
# 绘制陨石2
t.pencolor("gray")
t.fillcolor("gray")
t.begin_fill()
t.penup()
t.goto(180, -150)
t.pendown()
t.circle(80)
t.end_fill()
t.pencolor("white")
t.fillcolor("white")
t.begin_fill()
t.penup()
t.goto(200, -180)
t.pendown()
t.circle(20)
t.end_fill()
t.begin_fill()
t.penup()
t.goto(150, -240)
t.pendown()
t.circle(20)
t.end_fill()
# 绘制陨石3
t.pencolor("gray")
t.fillcolor("gray")
t.begin_fill()
t.penup()
t.goto(-270, -50)
t.pendown()
t.circle(80)
t.end_fill()
t.pencolor("white")
t.fillcolor("white")
t.begin_fill()
t.penup()
t.goto(-250, -80)
t.pendown()
t.circle(20)
t.end_fill()
t.begin_fill()
t.penup()
t.goto(-300, -140)
t.pendown()
t.circle(20)
t.end_fill()
# 太阳
t.pencolor('red')
t.fillcolor('yellow')
t.penup()
t.goto(-500, 250)
t.pendown()
t.begin_fill()
for i in range(10):
for i in range(4):
t.forward(120)
t.left(90)
t.right(36)
t.end_fill()
star_喵all(30,40,10)
star_喵all(130, 140,10)
star_喵all(-30, -50,10)
star_喵all(90, -80,10)
star_喵all(60, -400,10)
star_喵all(-300, 40,10)
star_喵all(370, -40,10)
star_喵all(50, -90,10)
star_喵all(30, 40,10)
star_喵all(-40, 350,10)
star_喵all(10, 40,10)
t.pencolor("white")
star_喵all(30-200, 40-50, 10)
star_喵all(130-200, 140-50, 10)
star_喵all(-30-200, -50-50, 10)
star_喵all(90-200, -80-50, 10)
star_喵all(60-200, -400-50, 10)
star_喵all(-300-200, 40-50, 10)
star_喵all(370-200, -40-50, 10)
star_喵all(50-200, -90-50, 10)
star_喵all(30-200-100, 40-50, 10)
star_喵all(-40-200, 350-50, 10)
star_喵all(10-200-100, 40-50, 10)
t.pencolor("pink")
t.penup()
t.goto(-700, -200)
t.pendown()
t.write("妈妈节日快乐,\n祝妈妈乐观心态对待每一天!", font=('Arial', 20))
turtle.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn
Arc_哇呜imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E5%8E%89%E5%AE%B3%E4%BA%86.gif"alt="emotion_编程猫_厉害了"
点赞0
评论