I'm trying to learn pyglet, and have installed 1.2alpha with python3.3.2
64bit edition.
I have a simple script for loading an image form a sprite sheet and
displaying it as a large map.
class grid(pyglet.image.ImageGrid):
def __init__(self, sprite):
super(grid, self).__init__(sprite, 3, 1, 96, 96)
class map_tile(pyglet.sprite.Sprite):
def __init__(self, file):
super(map_tile, self).__init__(pyglet.resource.image(file))
class screen(pyglet.window.Window):
def __init__(self, w, h):
super(screen, self).__init__(w, h)
self.clock = pyglet.clock.ClockDisplay()
pyglet.clock.schedule_interval(self.update, 1/60.)
raw = pyglet.image.load('images/map_sprites.png')
raw_seq = pyglet.image.ImageGrid(raw, 3, 1, 96, 96)
self.batch = pyglet.graphics.Batch()
self.collection = []
x, y = 0, 0
for i in range(100):
for j in range(100):
sprite = pyglet.sprite.Sprite(raw_seq[2], batch =
self.batch)
sprite.x = x
sprite.y = y
self.collection.append(sprite)
x += 96
y += 96
x = 0
def update(self, dt):
pass
def on_draw(self):
self.clear()
self.batch.draw()
self.clock.draw()
pyglet.clock.tick()
if __name__ == '__main__':
s = screen(1600, 900)
pyglet.app.run()
However, when trying to run this, I get the following error:
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\pyglet\__init__.py", line 332, in
__getattr__
return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'ImageGrid'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Pittler\Desktop\Dev\extra\pyglet
experimentation\bullet_client.py", line 12, in <module>
class grid(pyglet.image.ImageGrid):
File "C:\Python33\lib\site-packages\pyglet\__init__.py", line 338, in
__getattr__
__import__(import_name)
File "C:\Python33\lib\site-packages\pyglet\image\__init__.py", line 189
except codecs.ImageDecodeException, e:
^
SyntaxError: invalid syntax
The program worked fine in python2.7 32bit, but now it's not working. What
might the problem be and how do I fix it?
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.