title: Pyglet : Render multiple object in a batch
body: <p>I would like to know in pyglet how to render multiple object in a batch.</p>
  <p>I have try to edit init from the ball class but i don't success to change it
  How can I access to the init because if i put batch=batch it create an error. I don't know if its clear...</p>
  <p>Here is my code and i have this following error :</p>
  <pre><code>__init__() got an unexpected keyword argument 'batch'
  </code></pre>
  <p>my code</p>
  <pre><code>from pyglet import *
  from pyglet.gl import *
  import particles as prt
  
  # Indented oddly on purpose to show the pattern:
  UP    = 0b0001
  DOWN  = 0b0010
  LEFT  = 0b0100
  RIGHT = 0b1000
  
  class ball(pyglet.sprite.Sprite):
      def __init__(self, parent, image='Red_Circle.png', x=0, y=0):
          self.texture = pyglet.image.load(image)
          pyglet.sprite.Sprite.__init__(self, self.texture, x=x, y=y)
          self.parent = parent
          self.direction = UP | RIGHT # Starting direction
  
  
      def update(self,scalef=None):
  
          if scalef is not None:
              self._scale = scalef
          # We can use the pattern above with bitwise operations.
          # That way, one direction can be merged with another without collision.
          if self.direction &amp; UP:
              self.y += 1
          if self.direction &amp; DOWN:
              self.y -= 1
          if self.direction &amp; LEFT:
              self.x -= 1
          if self.direction &amp; RIGHT:
              self.x += 1
  
          if self.x+self.width &gt; self.parent.width:
              self.direction = self.direction ^ RIGHT # Remove the RIGHT indicator
              self.direction = self.direction ^ LEFT # Start moving to the LEFT
          if self.y+self.height &gt; self.parent.height:
              self.direction = self.direction ^ UP # Remove the UP indicator
              self.direction = self.direction ^ DOWN # Start moving DOWN
          if self.y &lt; 0:
              self.direction = self.direction ^ DOWN
              self.direction = self.direction ^ UP
          if self.x &lt; 0:
              self.direction = self.direction ^ LEFT
              self.direction = self.direction ^ RIGHT
  
      def render(self):
          self.draw()
  
  class main(pyglet.window.Window):
      def __init__ (self, width=800, height=600, fps=False, *args, **kwargs):
          super(main, self).__init__(width, height, *args, **kwargs)
          self.x, self.y = 0, 0
  
          batch = pyglet.graphics.Batch()
          ball_sprites = []
          for i in range(100):
              x, y = i * 10, 50
              ball1= ball(x, y)
              ball_sprites.append(ball1)
              print(ball_sprites)
  
  
  
  
          self.ball = ball(self, x=100, y=100)
          self.alive = 1
  
      def on_draw(self):
          self.render()
  
      def on_close(self):
          self.alive = 0
  
      def render(self):
          
          self.clear()
          self.ball.update(0.01)
          self.ball.update()
          self.ball.render()
          
          self.flip()
  
      def run(self):
          while self.alive == 1:
              self.render()
              event = self.dispatch_events()
  
  if __name__ == '__main__':
      x = main()
      x.run()
  </code></pre>
  <p>Thanks !</p>