located at the page: http://www.pyglet.org/doc/api/pyglet.sprite-module.html
the code: is missing a closing parenthesis on .append() to run.
from:
ball_sprites.append(pyglet.sprite.Sprite(ball_image, x, y, batch=batch)
to
ball_sprites.append(pyglet.sprite.Sprite(ball_image, x, y, batch=batch))
I added screen width/height:
window = pyglet.window.Window()
ball_image = pyglet.image.load('ball.png')
batch1 = pyglet.graphics.Batch()
ball_sprites = []
for i in range(200):
x, y = randint(0,window.width), randint(0,window.height)
ball_sprites.append(pyglet.sprite.Sprite(ball_image, x, y,
batch=batch1))
@window.event
def on_draw():
batch1.draw()
pyglet.app.run()
--
Jake