今天终于搞明白怎么把绝对路径内的视频文件和音频文件导入到资源。。。
代码:
#-*- coding:gbk -*- import pyglet import os window=pyglet.window.Window(caption='my player') player=pyglet.media.Player() pyglet.resource.path=['E:music'] pyglet.resource.reindex() for root,dirname,files in os.walk('E:music'): for f in files: source=pyglet.resource.media(f) player.queue(source) player.play() @window.event def on_draw(): window.clear() player.get_texture().blit(0,0) pyglet.app.run()