Either this is not my day, or my install of pyglet is borked... Having
copied your example into a file and run it (from the correct location), I
get the following:
  File "region.py", line 2, in <module>
    i = pyglet.image.load('examples/programming_guide/kitten.jpg')
  File "pyglet/image/__init__.py", line 194, in load
    raise first_exception
pyglet.image.codecs.dds.DDSException: Invalid DDS file (incorrect header).

Am I just being incredibly dense, or is something wrong my install? I don't
get why the DDS loader would be invoked for a jpg.

On Tue, Dec 23, 2008 at 6:40 PM, Alex Holkner <[email protected]>wrote:

>
> 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.
>
> >
>


-- 
Tristam MacDonald
http://swiftcoder.wordpress.com/

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to