Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 更改雪碧派格莱特的批次_Python 3.x_Pyglet - Fatal编程技术网

Python 3.x 更改雪碧派格莱特的批次

Python 3.x 更改雪碧派格莱特的批次,python-3.x,pyglet,Python 3.x,Pyglet,如何在pyglet中更改精灵的批处理对象 def createSprite(obj, batch, layer): img = pyglet.resource.image(obj.path) img.width = obj.w img.height = obj.h return pyglet.sprite.Sprite(img, x=obj.x, y=obj.y, batch=batch, group=layer) 非常模糊的问题。。。但是,好的主题 在pygl

如何在pyglet中更改精灵的批处理对象

def createSprite(obj, batch, layer):
    img = pyglet.resource.image(obj.path)
    img.width = obj.w
    img.height = obj.h
    return pyglet.sprite.Sprite(img, x=obj.x, y=obj.y, batch=batch, group=layer)

非常模糊的问题。。。但是,好的主题

在pyglet中,
sprite
对象有一个名为
batch
的属性,可以在执行时更改该属性。非常简单,假设
x
是Sprite类的对象,那么:

x.batch = pyglet.graphics.Batch()