【发布时间】:2012-09-08 21:05:51
【问题描述】:
我想通过 SoundLoader 模块在 kivy 中加载多个声音文件 (*.ogg)。文件大小从 300kB 到 700kB 不等。
发生的情况是:加载前几个文件,然后跳过其余文件。
有没有更好(也许更快)的方式来加载文件?是否可以将已加载的文件“链接”到另一个 Button 实例,而无需复制它(或损害其文本)?
这是有问题的代码:
#Getting filenames:
for line in rawsongs:
if ',' in line:
items = line.split(', ')
#Creating instances of Buttons, which control (play and stop)
#the soundfiles:
btn = AudioButton(
text=(items[1]+' - '+items[2]), font_size=50,
sound = SoundLoader.load(items[2]+'.ogg'),
size_hint_y = None, height = 240, group = 'audio')
#adding the Button to the Layout:
grid.add_widget(btn)
else:
pass
提前致谢 ;)
【问题讨论】: