用户:
花金柔查看:0 回复:0 评论:0 创建时间:2021-05-14T22:07:56
【作品展示】

【作品介绍】
水作
【作品源代码】
import turtle as t
import easygui as e
import random as r
e.msgbox('Hello,欢迎来到“创建星系”界面~', '提示界面', '继续')
e.msgbox('这里,你可以创造一个属于你自己的星系~','提示界面','继续')
e.msgbox('那么,现在开始吧~','提示界面','开始')
F1=e.choicebox('请选择星球数量(数量越多需要的时间越长)','初始化',choices=['20', '50','70','100'])
F1=int(F1)
F2 = e.enterbox('恒星X坐标(-300~300)')
F2=int(F2)
while (not (F2 < 300 and F2 > -300)):
F2=e.enterbox('请认真输入恒星X坐标(-300~300)!')
F2=int(F2)
F3=e.enterbox('恒星Y坐标(-300~300)')
F3=int(F3)
while (not (F3 < 300 and F3 > -300)):
F3=e.enterbox('请认真输入恒星Y坐标(-300~300)!')
F3=int(F3)
F4=e.choicebox('请输入恒星大小','初始化',choices=['60','80', '100'])
F4=int(F4)
F5=e.choicebox('请输入恒星颜色','初始化',choices=['red','blue','yellow'])
F6=e.enterbox('给你的星系取个名吧~')
#绘画
t.hideturtle()
t.speed(0)
t.bgcolor('black')
t.pencolor("#ffffff")
for a in range(F1):
t.penup()
x=r.randint(-300,300)
y=r.randint(-300,300)
s=r.randint(2,20)
t.goto(x, y)
t.pendown()
t.dot(s)
t.up()
t.goto(F2,F3)
t.color(F5)
t.down()
t.dot(F4)
t.up()
if F5 == "red":
t.color("#ffcccc")
elif F5 == "blue":
t.color("#99ffff")
else:
t.color("#ffff99")
t.pensize(10)
t.down()
t.backward(F4)
t.forward(2*F4)
t.up()
t.goto(0,300)
t.down()
t.write(F6, font=('Arial', 20, 'bold'))
t.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn