猫史档案馆


【Python作品分享】36强进10(浩瀚星空v2.0)

用户:小飞侠灰灰小飞侠灰灰查看:0 回复:1 评论:0 创建时间:2021-05-23T22:25:34


【作品展示】

center_image

 

【作品介绍】

这是一个用海龟编辑器做出的智能航空明信片制作器,你可以对心中的航天员说出自己想说的话

 

【作品源代码】

import turtle
import time
import random

__Pen = turtle.Pen()


#开始进入Python的世界
turtle.bgcolor("#000000")
__Pen.hideturtle()
print('你好!', '欢迎进入“给航天员的明信片”制作')
time.sleep(1)
print('3秒后开始展示')
time.sleep(1)
print('3')
time.sleep(1)
print('2')
time.sleep(1)
print('1')
time.sleep(1)
print('开始!')

#开始进入Python的世界
星星 = turtle.Pen()
星星.hideturtle()
星星.speed(0)
for __count in range(30):
    星星.penup()
    星星.setx(random.randint((-650), 650))
    星星.sety(random.randint((-300), 300))
    星星.pendown()
    星星.fillcolor("#ffffff")
    星星.begin_fill()
    星星.right(70)
    星星.forward(5)
    星星.left(50)
    星星.forward(5)
    for __count in range(3):
        星星.right(140)
        星星.forward(5)
        星星.left(50)
        星星.forward(5)
    星星.end_fill()
for __count in range(30):
    星星.penup()
    星星.setx(random.randint((-650), 650))
    星星.sety(random.randint((-300), 300))
    星星.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()

#开始进入Python的世界
摩羯座 = turtle.Pen()
摩羯座.hideturtle()
摩羯座.speed(0)
摩羯座.pencolor("#ffffff")
摩羯座.penup()
摩羯座.goto(550, -100)
摩羯座.pendown()
摩羯座.right(110)
摩羯座.dot(10)
摩羯座.forward(40)
摩羯座.dot(10)
摩羯座.right(20)
摩羯座.forward(100)
摩羯座.dot(10)
摩羯座.right(30)
摩羯座.forward(20)
摩羯座.dot(10)
摩羯座.right(10)
摩羯座.forward(30)
摩羯座.dot(10)
摩羯座.left(50)
摩羯座.forward(15)
摩羯座.dot(10)
摩羯座.left(125)
摩羯座.forward(30)
摩羯座.dot(10)
摩羯座.right(45)
摩羯座.forward(40)
摩羯座.dot(10)
摩羯座.left(50)
摩羯座.forward(35)
摩羯座.dot(10)
摩羯座.right(25)
摩羯座.forward(20)
摩羯座.dot(10)
摩羯座.left(80)
摩羯座.forward(20)
摩羯座.dot(10)
摩羯座.left(25)
摩羯座.forward(110)

#开始进入Python的世界
边框 = turtle.Pen()
边框.hideturtle()
边框.penup()
边框.goto((-580), 220)
边框.pencolor("yellow")
边框.pendown()
边框.write(turtle.textinput('明信片', '收件人(请加上冒号)'), font = ('Arial', 27, 'normal'))
边框.penup()
边框.goto((-470), 150)
边框.pendown()
边框.write(turtle.textinput('明信片', '祝福语(最多输入28字)'), font = ('Arial', 28, 'italic'))
边框.penup()
边框.goto((470), (50))
边框.pendown()
边框.write(turtle.textinput('明信片', '署名'), font = ('Arial', 27, 'normal'))
边框.penup()
边框.goto((470), (0))
边框.pendown()
边框.write(turtle.textinput('明信片', "日期(年、月、日用'.'表示)"), font = ('Arial', 25, 'normal'))

#开始进入Python的世界
宇航员 = turtle.Pen()
宇航员.hideturtle()
宇航员.speed(0)
宇航员.pencolor('brown')
宇航员.penup()
宇航员.goto((-650), (-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(30)
宇航员.pendown()
宇航员.fillcolor("#ffffff")
宇航员.begin_fill()
for __count in range(90):
    宇航员.forward(1)
    宇航员.right(1)
宇航员.forward(50)
宇航员.left(90)
宇航员.forward(40)
宇航员.right(90)
宇航员.forward(30)
宇航员.right(90)
宇航员.forward(70)
宇航员.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(80)
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()

#开始进入Python的世界
红旗 = turtle.Pen()
红旗.hideturtle()
红旗.pencolor('white')
红旗.left(30)
红旗.penup()
红旗.goto((-470), (-150))
红旗.left(90)
红旗.pencolor('red')
红旗.fillcolor('red')
红旗.begin_fill()
红旗.pendown()
红旗.pensize(5)
红旗.forward(200)
红旗.pensize(0)
红旗.right(90)
红旗.forward(210)
红旗.right(90)
红旗.forward(140)
红旗.right(90)
红旗.forward(210)
红旗.end_fill()
红旗.penup()
红旗.right(90)
红旗.forward(115)
红旗.right(90)
红旗.forward(40)
红旗.pencolor('yellow')
红旗.fillcolor('yellow')
红旗.begin_fill()
红旗.pendown()
for __count in range(0, 5):
    红旗.right(216)
    红旗.forward(30)
红旗.end_fill()
红旗.penup()
红旗.right(90)
红旗.forward(40)
红旗.right(90)
红旗.forward(30)
红旗.left(90)
红旗.pencolor('yellow')
红旗.fillcolor('yellow')
红旗.begin_fill()
红旗.pendown()
for __count in range(0, 5):
    红旗.right(216)
    红旗.forward(20)
红旗.end_fill()
红旗.penup()
红旗.left(90)
红旗.forward(20)
红旗.left(90)
红旗.forward(25)
红旗.pencolor('yellow')
红旗.fillcolor('yellow')
红旗.begin_fill()
红旗.pendown()
for __count in range(0, 5):
    红旗.right(216)
    红旗.forward(20)
红旗.end_fill()
红旗.penup()
红旗.right(90)
红旗.forward(20)
红旗.left(90)
红旗.forward(15)
红旗.pencolor('yellow')
红旗.fillcolor('yellow')
红旗.begin_fill()
红旗.pendown()
for __count in range(0, 5):
    红旗.right(216)
    红旗.forward(20)
红旗.end_fill()
红旗.penup()
红旗.right(90)
红旗.forward(20)
红旗.left(90)
红旗.forward(15)
红旗.pencolor('yellow')
红旗.fillcolor('yellow')
红旗.begin_fill()
红旗.pendown()
for __count in range(0, 5):
    红旗.right(216)
    红旗.forward(20)
红旗.end_fill()

#开始进入Python的世界
卫星 = turtle.Pen()
卫星.hideturtle()
卫星.speed(0)
卫星.penup()
卫星.goto(100, 0)
卫星.forward(100)
卫星.right(180)
卫星.fillcolor('blue')
卫星.begin_fill()
卫星.pendown()
卫星.forward(100)
卫星.left(90)
卫星.forward(40)
卫星.left(90)
卫星.forward(100)
卫星.end_fill()
卫星.penup()
卫星.left(90)
卫星.forward(20)
卫星.right(180)
卫星.fillcolor("#33ff33")
卫星.begin_fill()
卫星.pendown()
卫星.circle(30)
卫星.end_fill()
卫星.left(90)
卫星.penup()
卫星.forward(60)
卫星.left(90)
卫星.forward(20)
卫星.right(90)
卫星.fillcolor('blue')
卫星.begin_fill()
卫星.pendown()
卫星.forward(100)
卫星.right(90)
卫星.forward(40)
卫星.right(90)
卫星.forward(100)
卫星.end_fill()
卫星.right(135)
卫星.forward(56)
卫星.right(90)
卫星.forward(56)
卫星.left(90)
卫星.forward(28)
卫星.right(135)
卫星.forward(20)
卫星.right(90)
卫星.penup()
卫星.forward(260)
卫星.pendown()
卫星.right(135)
卫星.forward(56)
卫星.right(90)
卫星.forward(56)
卫星.left(90)
卫星.forward(28)
卫星.penup()
卫星.right(135)
卫星.forward(20)
卫星.left(90)
卫星.forward(25)
卫星.fillcolor("#339999")
卫星.begin_fill()
卫星.pendown()
卫星.right(120)
卫星.forward(40)
卫星.left(120)
卫星.forward(60)
卫星.left(120)
卫星.forward(40)
卫星.end_fill()
卫星.penup()
卫星.goto(100, 0)
卫星.right(120)
卫星.forward(130)
卫星.right(90)
卫星.forward(喵)
卫星.pencolor("#339999")
卫星.pensize(5)
卫星.pendown()
卫星.forward(100)
卫星.penup()
卫星.right(180)
卫星.forward(160)
卫星.pensize(9)
卫星.pendown()
卫星.forward(20)

#开始进入Python的世界
太阳 = turtle.Pen()
太阳.hideturtle()
太阳.pencolor("#ffcc00")
太阳.penup()
太阳.goto(500, 200)
太阳.fillcolor("#ffcc00")
太阳.begin_fill()
太阳.penup()
太阳.circle(100)
太阳.end_fill()

#开始进入Python的世界
移动星球 = turtle.Pen()
移动星球.speed(0)
移动星球.shape('circle')
移动星球.penup()
移动星球.goto((-100), -100)
移动星球.pendown()
while True:
    移动星球.right(1)
    移动星球.pencolor("#ffffff")
    移动星球.fillcolor("#ffffff")
    移动星球.begin_fill()
    移动星球.forward(1)
    移动星球.pencolor("#ff0000")
    移动星球.fillcolor("#ff0000")
    移动星球.begin_fill()
    移动星球.right(1)
    移动星球.pencolor("#ff6600")
    移动星球.fillcolor("#ff6600")
    移动星球.begin_fill()
    移动星球.forward(1)
    移动星球.pencolor("#ffff00")
    移动星球.fillcolor("#ffff00")
    移动星球.begin_fill()
    移动星球.right(1)
    移动星球.pencolor("#009900")
    移动星球.fillcolor("#009900")
    移动星球.begin_fill()
    移动星球.forward(1)
    移动星球.pencolor("#33ccff")
    移动星球.fillcolor("#33ccff")
    移动星球.begin_fill()
    移动星球.right(1)
    移动星球.pencolor("#33ff33")
    移动星球.fillcolor("#33ff33")
    移动星球.begin_fill()
    移动星球.forward(1)
    边框.pencolor("#6600cc")
    移动星球.fillcolor("#6600cc")
    移动星球.begin_fill()
turtle.done()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
HJS_鱼缸下的我HJS_鱼缸下的我

是“【36强进10】”,要加【】啊

点赞0


评论