On 12/24/08, Tristam MacDonald <[email protected]> wrote:
> Has anyone had any luck using ImageDataRegion.get_data()? I always get the
> following error when trying to call it:
>
> File
> "/Library/Python/2.5/site-packages/pyglet/image/__init__.py",
> line 1142, in get_data
> rows = [row[x1:x2] for row in
> rows[self.y:self.y+self.height]]
> TypeError: slice indices must be integers or None or have an __index__
> method
>
> I have tried this every which way, so I don't think I am doing anything
> wrong. If anyone has any thoughts, or perhaps a working code sample, I would
> love to check it out.
Here's a (not very useful) working example. If you're still having
trouble, perhaps post a code sample that doesn't work.
import pyglet
i = pyglet.image.load('examples/programming_guide/kitten.jpg')
d = i.get_image_data()
d.get_region(20, 20, 40, 40)
d.get_data('RGBA', d.pitch)
Alex.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---