Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pyglet - Batch Group
import pyglet
#index all resources
pyglet.resource.path = ['resources']
#create window object
screen = pyglet.window.Window(800, 600)
#create batch group to put all objects in
main_batch =
#create player object
player_image = pyglet.resource.image("player.png")
player_sprite = pyglet.sprite.Sprite(img=player_image,x=400,y=300, batch=main_batch)
#create text label
score_label = pyglet.text.Label(text="Hello World", x=100, y=500, batch=main_batch)
def on_draw():
#draw batch group (player and text)
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment