eschneiderSA / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Tuple slice on ImageGrid documented but not implemented #681

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In the documentation 
http://www.pyglet.org/doc/programming_guide/image_sequences_and_atlases.html#ima
ge-grids, 

we can find that ImageGrid can be sliced using indexes. However, this does not 
seem to be the case in the current repository version.

To reproduce the problem, use

texture = pyglet.image.ImageGrid(pyglet.image.load('tiles/tiles.png'), 2, 2)
texture[0, 0]

which gives

Traceback (most recent call last):
  File "pyglet_test_2d.py", line 193, in <module>
    app.mainLoop()
  File "pyglet_test_2d.py", line 183, in mainLoop
    self.world.draw()
  File "pyglet_test_2d.py", line 142, in draw
    texture = texture[0, 0].get_texture()
  File ".env/opengl/lib/python2.7/site-packages/pyglet/image/__init__.py", line 2252, in __getitem__
    return self._items[index]
TypeError: list indices must be integers, not tuple

Notice that this works correctly for TextureGrid:

texture = pyglet.image.ImageGrid(pyglet.image.load('tiles/tiles.png'), 2, 2)
texture = pyglet.image.TextureGrid(texture)
texture[0, 0]

Original issue reported on code.google.com by jorgecar...@gmail.com on 9 Nov 2013 at 10:46

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
The docs for the repo version (1.2) are here:

http://pyglet-current.usebox.net/programming_guide/image.html#image-grids

Anyway, there's a "# TODO tuples" in ImageGrid... so yes, this is not 
implemented :)

Original comment by useboxnet on 16 Nov 2013 at 10:41

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 49a352b38077.

Original comment by useboxnet on 28 Nov 2013 at 7:33