猫史档案馆


【Python作品分享】【去太空,趣编程】太空星球【作品秀】

用户:功夫团功夫团查看:0 回复:1 评论:0 创建时间:2021-05-05T17:02:53


【作品展示】

center_image

 

【作品介绍】

我的太空星球,带大家粗略了解下太空。我的作品演示了星辰变换,其中放大了太阳和月亮的交替过程。

 

【作品源代码】

import turtle
import time
import random

__Pen = turtle.Pen()


print('去太空,趣编程')
__Pen.clear()
__Pen.hideturtle()
__Pen.speed(10)
yyy = turtle.Pen()
yyy = input('你的名字?')
print('欢迎', yyy, '来到我的太空世界。')
time.sleep(2)
print('太空是黑漆漆的一片。')
turtle.bgcolor("#000000")
time.sleep(1)
print('后来有了发光的星星。')
for __count in range(random.randint(10, 20)):
    __Pen.penup()
    __Pen.goto(random.randint((-200), 200), random.randint((-200), 200))
    __Pen.pendown()
    __Pen.pencolor("#ffcc33")
    __Pen.circle(1)
print('在无边的太空中有无数的星星闪着耀眼的光芒,可能有些离我们太远所以我们看不见。有些则组成了星系,十分美丽。')
time.sleep(3)
print('而我们能够看见的星星中有两个是大家都知道的————月亮和太阳。')
time.sleep(3)
__Pen.hideturtle()
__Pen.penup()
__Pen.clear()
__Pen.goto(0, 0)
__Pen.pencolor("#ff6600")
__Pen.pendown()
__Pen.dot(100)
print('太阳随着时间的流逝而发生颜色上的变化。')
time.sleep(2)
__Pen.pencolor("#ff9900")
__Pen.pendown()
print('烈日当空')
__Pen.dot(100)
time.sleep(2)
__Pen.hideturtle()
__Pen.pencolor("#ff6600")
__Pen.pendown()
print('落日(找不到特别合适的)')
__Pen.dot(100)
time.sleep(1)
__Pen.right(90)
for __count in range(100):
    __Pen.clear()
    __Pen.forward(4)
    __Pen.pencolor("#ff6600")
    __Pen.pendown()
    __Pen.dot(100)
    __Pen.penup()
    time.sleep(0.01)
__Pen.goto(0, 0)
__Pen.pencolor("#ffffff")
__Pen.dot(100)
print('一轮圆月挂在空中,提醒打工人们回家休息。')
time.sleep(3)
__Pen.clear()
turtle.bgcolor("#ffffff")
__Pen.pencolor("#000000")
__Pen.pensize(200)
__Pen.write('thank you!')
turtle.done()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
功夫团功夫团

棒哒哒,小学组的伙伴们,冲冲冲emotion_编程猫_嗨起来

点赞0


评论