documentation typo in example

16 views
Skip to first unread message

Jake b

unread,
Apr 3, 2011, 2:31:49 AM4/3/11
to pyglet...@googlegroups.com
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

anatoly techtonik

unread,
Apr 8, 2011, 3:11:58 AM4/8/11
to pyglet...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages