用户:
小飞侠灰灰查看:0 回复:0 评论:0 创建时间:2021-05-16T22:03:06
【作品展示】

【作品介绍】
该作品是一幅用海龟编辑器制作的航天图画。点击运行,你可以控制星星数量和星星转动圈数以及现在的显示,你还可以获得3条有关航天的知识。让我们一起走进太空,探索太空的奥秘吧!
【作品源代码】
import turtle
import time
import random
__Pen = turtle.Pen()
#开始进入Python的世界
turtle.bgcolor("#000000")
print(str(input('你的名字?')), '欢迎来到航空展示馆!')
print('下面请依次输入1.2.3.4')
知识 = int(input('你想要了解哪些宇宙飞船知识(宇宙飞船含义输入1,宇宙飞船推力输入2,第一艘载人飞船输入3,如要跳过请按4)'))
if (知识 == 1):
print('宇宙飞船,是一种运送航天员.货物到达太空并安全返回的一次性航天器。它能基本保证航天员在太空短期生活并进行一定的工作。它的运行时间一般在几天到半个月,一般乘2到3个航天员。')
知识 = int(input('你想要了解哪些宇宙飞船知识(宇宙飞船含义输入1,宇宙飞船推力输入2,第一艘载人飞船输入3,如要跳过请按4)'))
if (知识 == 2):
print('飞船在太空飞行所受的阻力很小,所以飞船只在发射.变轨.减速时需要推力')
知识 = int(input('你想要了解哪些宇宙飞船知识(宇宙飞船含义输入1, 宇宙飞船推力输入2, 第一艘载人飞船输入3,如要跳过请按4)'))
if (知识 == 3):
print('世界上第一艘载人飞船是“东方一号”飞船,由航天员座舱和设备舱组成')
知识 = int(input('你想要了解哪些宇宙飞船知识(宇宙飞船含义输入1, 宇宙飞船推力输入2, 第一艘载人飞船输入3,如要跳过请按4)'))
if (知识 == 4):
星座 = int(input('你想看星座吗?(按1键显示星座,否则你将错过最美的景色。)'))
星球转动圈数 = int(input('你想让星球转几圈?'))
大星星 = int(input('你想画几颗大星星?'))
较大星星 = int(input('你想画几颗较大星星?'))
小星星 = int(input('你想画几颗小星星?'))
较小星星 = int(input('你想画几颗较小星星?'))
print('3秒后开始展示')
time.sleep(1)
print('3')
time.sleep(1)
print('2')
time.sleep(1)
print('1')
time.sleep(1)
print('开始')
time.sleep(1)
#开始进入Python的世界
星星 = turtle.Pen()
星星.speed(0)
for __count in range(大星星):
星星.penup()
星星.setx(random.randint((-800), 800))
星星.sety(random.randint((-500), 500))
星星.pendown()
星星.fillcolor("#ffffff")
星星.begin_fill()
星星.right(70)
星星.forward(10)
星星.left(50)
星星.forward(10)
for __count in range(3):
星星.right(140)
星星.forward(10)
星星.left(50)
星星.forward(10)
星星.end_fill()
for __count in range(较大星星):
星星.penup()
星星.setx(random.randint((-800), 800))
星星.sety(random.randint((-500), 500))
星星.pendown()
星星.fillcolor("#ffffff")
星星.begin_fill()
星星.right(70)
星星.forward(8)
星星.left(50)
星星.forward(8)
for __count in range(3):
星星.right(140)
星星.forward(8)
星星.left(50)
星星.forward(8)
星星.end_fill()
for __count in range(小星星):
星星.penup()
星星.setx(random.randint((-800), 800))
星星.sety(random.randint((-500), 500))
星星.pendown()
星星.fillcolor("#ffffff")
星星.begin_fill()
星星.right(70)
星星.forward(6)
星星.left(50)
星星.forward(6)
for __count in range(3):
星星.right(140)
星星.forward(6)
星星.left(50)
星星.forward(6)
星星.end_fill()
for __count in range(较小星星):
星星.penup()
星星.setx(random.randint((-800), 800))
星星.sety(random.randint((-500), 500))
星星.pendown()
星星.fillcolor("#ffffff")
星星.begin_fill()
星星.right(70)
星星.forward(4)
星星.left(50)
星星.forward(4)
for __count in range(3):
星星.right(140)
星星.forward(4)
星星.left(50)
星星.forward(4)
星星.end_fill()
星星.hideturtle()
#开始进入Python的世界
__Pen.speed(0)
__Pen.showturtle()
__Pen.penup()
__Pen.goto(0, (-100))
__Pen.pendown()
__Pen.fillcolor("#ffcc66")
__Pen.begin_fill()
__Pen.left(90)
for __count in range(10):
__Pen.forward(20)
__Pen.right(3)
__Pen.right(110)
for __count in range(10):
__Pen.forward(20)
__Pen.right(3)
__Pen.right(83)
__Pen.forward(70)
__Pen.end_fill()
__Pen.penup()
__Pen.right(90)
__Pen.forward(60)
__Pen.right(90)
__Pen.forward((-30))
__Pen.right(90)
__Pen.pendown()
__Pen.fillcolor("#33cc00")
__Pen.begin_fill()
__Pen.circle(40)
__Pen.end_fill()
__Pen.penup()
__Pen.goto(0, (-120))
__Pen.right(10)
for __count in range(3):
__Pen.fillcolor("#ff0000")
__Pen.begin_fill()
__Pen.pendown()
__Pen.right(90)
__Pen.circle(30, steps=3)
__Pen.end_fill()
__Pen.penup()
__Pen.right(180)
__Pen.forward(70)
__Pen.right(90)
__Pen.hideturtle()
#开始进入Python的世界
星球 = turtle.Pen()
星球.speed(0)
星球.penup()
星球.goto((-450), (-50))
星球.fillcolor("#33ffff")
星球.begin_fill()
星球.pendown()
星球.circle(200)
星球.end_fill()
星球.penup()
星球.goto((-450), 50)
星球.pendown()
星球.pencolor("#009900")
星球.fillcolor("#009900")
星球.begin_fill()
星球.circle(30, steps=8)
星球.pensize(5)
星球.goto((-450), 150)
星球.circle(30, steps=6)
星球.end_fill()
星球.penup()
星球.goto((-550), 50)
星球.pendown()
星球.fillcolor("#009900")
星球.begin_fill()
星球.circle(30, steps=9)
星球.end_fill()
星球.penup()
星球.goto((-350), 200)
星球.pendown()
星球.fillcolor("#009900")
星球.begin_fill()
星球.circle(30, steps=9)
星球.goto((-600), 100)
星球.circle(30, steps=8)
星球.end_fill()
星球.hideturtle()
#开始进入Python的世界
宇航员 = turtle.Pen()
宇航员.speed(0)
宇航员.pencolor('brown')
宇航员.penup()
宇航员.goto(450, (-100))
宇航员.fillcolor("#ffffff")
宇航员.begin_fill()
宇航员.pendown()
宇航员.left(180)
for __count in range(300):
宇航员.forward(1)
宇航员.right(1)
宇航员.end_fill()
宇航员.penup()
宇航员.right(90)
宇航员.forward(10)
宇航员.left(60)
宇航员.forward(25)
宇航员.fillcolor("#999999")
宇航员.begin_fill()
宇航员.pendown()
宇航员.right(180)
宇航员.circle(40)
宇航员.end_fill()
宇航员.penup()
宇航员.forward(40)
宇航员.pendown()
宇航员.fillcolor("#ffffff")
宇航员.begin_fill()
for __count in range(90):
宇航员.forward(1)
宇航员.right(1)
宇航员.forward(50)
宇航员.right(90)
宇航员.forward(30)
宇航员.right(90)
宇航员.forward(50)
宇航员.right(180)
宇航员.forward(100)
宇航员.right(90)
宇航员.forward(20)
宇航员.left(90)
宇航员.forward(100)
宇航员.right(90)
宇航员.forward(40)
宇航员.right(90)
宇航员.forward(100)
宇航员.right(180)
宇航员.forward(100)
宇航员.right(90)
宇航员.forward(40)
宇航员.right(90)
宇航员.forward(100)
宇航员.left(90)
宇航员.forward(20)
宇航员.right(90)
宇航员.forward(100)
宇航员.right(180)
宇航员.forward(50)
宇航员.right(90)
宇航员.forward(30)
宇航员.right(90)
宇航员.forward(50)
for __count in range(90):
宇航员.forward(1)
宇航员.right(1)
宇航员.forward(5)
宇航员.end_fill()
宇航员.fillcolor("#666666")
宇航员.begin_fill()
宇航员.right(90)
宇航员.forward(100)
宇航员.left(90)
宇航员.forward(60)
宇航员.left(90)
宇航员.forward(100)
宇航员.end_fill()
宇航员.hideturtle()
#开始进入Python的世界
移动球 = turtle.Pen()
移动球.shape('circle')
移动球.speed(0)
移动球.goto(0, 170)
移动球.pencolor('red')
移动球.fillcolor('red')
移动球.begin_fill()
if (星座 == 1):
for _count in range((星球转动圈数 * 360)):
移动球.forward(1)
移动球.left(1)
elif (星座 != 1):
for _count in range((星球转动圈数 * 360)):
移动球.forward(1)
移动球.left(1)
turtle.done()
else:
pass
#开始进入Python的世界
if (星座 == 1):
北斗七星 = turtle.Pen()
北斗七星.speed(0)
北斗七星.penup()
北斗七星.goto(400, 300)
北斗七星.pendown()
北斗七星.pencolor("#ffffcc")
北斗七星.dot(5)
北斗七星.right(70)
北斗七星.forward(50)
北斗七星.dot(5)
北斗七星.left(70)
北斗七星.forward(50)
北斗七星.dot(5)
北斗七星.forward(50)
北斗七星.dot(5)
北斗七星.left(60)
北斗七星.forward(50)
北斗七星.dot(5)
北斗七星.right(72)
北斗七星.forward(50)
北斗七星.dot(5)
北斗七星.right(2)
北斗七星.forward(50)
北斗七星.dot(5)
北斗七星.hideturtle()
else:
turtle.done()
#开始进入Python的世界
if (星座 == 1):
双子座 = turtle.Pen()
双子座.speed(0)
双子座.penup()
双子座.goto((-600), (-150))
双子座.pencolor("#ffffcc")
双子座.pendown()
双子座.dot(5)
双子座.left(60)
双子座.forward(60)
双子座.dot(5)
双子座.right(70)
双子座.forward(60)
双子座.dot(5)
双子座.right(70)
双子座.forward(60)
双子座.dot(5)
双子座.left(70)
双子座.forward(60)
双子座.dot(5)
双子座.left(180)
双子座.forward(60)
双子座.left(75)
双子座.forward(60)
双子座.dot(5)
双子座.left(30)
双子座.forward(60)
双子座.dot(5)
双子座.left(45)
双子座.forward(50)
双子座.dot(5)
双子座.left(45)
双子座.forward(50)
双子座.dot(5)
双子座.penup()
双子座.goto((-600), (-150))
双子座.pendown()
双子座.right(120)
双子座.forward(60)
双子座.dot(5)
双子座.right(180)
双子座.forward(60)
双子座.right(140)
双子座.forward(60)
双子座.dot(5)
双子座.right(25)
双子座.forward(60)
双子座.dot(5)
双子座.right(45)
双子座.forward(50)
双子座.dot(5)
双子座.hideturtle()
turtle.done()
else:
turtle.done()
#开始进入Python的世界
__Pen.hideturtle()
__Pen.penup()
__Pen.setx((-150))
__Pen.sety(0)
__Pen.pencolor("#33ff33")
__Pen.pendown()
__Pen.write('谢谢观赏!', font = ('Arial', 50, 'bold'))
turtle.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn