pyglet absolute path relative path

Load absolute path:

# 加载 3D 模型文件
model_path = "/path/to/model.obj"
model = pyglet.resource.file(model_path)

import pyglet

window = pyglet.window.Window()

pyglet.resource.path=['D:\demo']
pyglet.resource.reindex()

mouth = pyglet.resource.image(r'aaa.jpg')

raw = pyglet.image.load(r'D:\project\detect\jupter_demo\aaa_384.png')
raw_seq = pyglet.image.ImageGrid(raw, 1, 2)

animation = pyglet.image.Animation.from_image_sequence(raw_seq, .11, True)
mouth2 = pyglet.sprite.Sprite(animation)

w = window.width
h = window.height

@window.event
def on_draw():
    window.clear()
    mouth2.draw()

if __name__ == '__main__':
    pyglet.app.run()

Guess you like

Origin blog.csdn.net/jacke121/article/details/129670395