

风火轮编程培训list.append教学演示程序,以下是所有源代码:
"""
列表来了新客人(白雪公主入列表).py
list.append命令演示程序
"""
from sprites import *
w = Sprite('blank')
w.sety(200)
w.write('list.append命令演示程序',align='center',font=('',32))
w.sety(150)
w.write('请按空格键',align='center',font=('',18))
lis = list('abcdefg')
princess = '\'白雪公主\''
txt2image(princess,f'res/{princess}.png',fontsize=32)
p = Sprite(f'res/{princess}.png')
p.sety(100)
screen = Screen()
screen.listen()
listr = str(lis)
txt2image(listr,'res/guest_list.png',fontsize=32)
biao = Sprite('res/guest_list.png')
space = Key('space')
while not space.downup():screen.update() # 按空格键开始
for i in range(18):
s = listr[:-1] + "," + ' ' * (i+1) + "]"
name = f'res/{i+1}_guest_list.png'
txt2image(s,name,fontsize=32)
biao.shape(name)
biao.wait(0.1)
p.slide((174,0))
w.clear()
w.sety(180)
w.write('请再按空格键',align='center',font=('',28))
while not space.downup():screen.update() # 按空格键开始
p.shape('白雪公主.png')
p.say('Hello,你好')
screen.mainloop()
