用户:
淳朴的木叶龙lbxn查看:0 回复:0 评论:0 创建时间:2024-01-02T19:08:14
【作品展示】

【作品介绍】
11111111
【作品源代码】
import easygui as g
import random
import turtle as t
cc =['lightpink', 'pink', 'gold', 'red', 'blue','tan',
'green', 'black', 'purple', 'cyan', 'yellow', 'orange',
'tomato', 'brown', 'white', 'gray', 'bisque','sandybrown',
'chocolate', 'addlebrown', 'sienna', 'coral', 'darksalmon'
]
n=g.enterbox('请输入烟花支数:','烟花数量')
c=g.enterbox('请输入烟花颜色,可以参考下方颜色表:'+' '.join(cc)+'注意:颜色能使用多种但需要用空格隔开且是英文单词','烟花颜色')
x=g.enterbox('请输入烟花组成形状(圆形、三角形、正方形、海龟、箭头):','烟花形状')
if n=='':
n=3
if c=='':
c='red green blue'
if x=='' or x=='圆形':
x='circle'
elif x=='三角形':
x ='triangle'
elif x=='正方形':
x='喵'
elif x=='海龟':
x='turtle'
elif x=='箭头':
x='arrow'
else:
x='circle'
new_c = c.split(' ')
t.setup(800,500)
t.bgpic('背景图11.png')
for i in range(int(n)):
t.title('烟花绽放')
t.pensize(2)
t.shape(x)
t.penup()
t.goto(random.randint(-300, 300), random.randint(-200, 200))
c1=random.choice(new_c)
c2=random.choice(new_c)
a = random.randint(20, 40)
b=random.randint(60,80)
for j in range(36):
t.speed(7)
t.shape(x)
t.pencolor(c1)
t.shapesize(0.3,0.3)
t.pendown()
t.forward(a)
t.dot(6)
t.stamp()
t.forward(-a)
t.right(5)
t.pencolor(c2)
t.forward(b)
t.dot(6)
t.stamp()
t.forward(-b)
t.right(5)
t.penup()
t.goto(-100, -150)
t.color('yellow')
t.write("元旦快乐!", font=("Times", 50,'bold'))
t.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn