image.TextureGrid error when given an ImageGrid

20 views
Skip to first unread message

Nicky Mac

unread,
May 8, 2020, 7:18:39 AM5/8/20
to pyglet-users
I am attempting to draw a Skybox from an existing file with the following code:

    boxname = 'skybox1.jpg'   
    print('Loading',boxname)
    skygrid = image.load(os.path.join('Assets', boxname))
    sky_grid = image.ImageGrid(skygrid, 3,4)
    sky = image.TextureGrid(sky_grid) # resource KeyError: <TextureRegion 64x64>
    sky_frames = [sky[4], sky[6], sky[9], sky[1], sky[7], sky[5]]

------------------------------ here's what happens: ----------------------------------------
Loaded skybox1.jpg
Traceback (most recent call last):
  File "C:\Python\Python36\lib\site-packages\pyglet\resource.py", line 435, in file
    location = self._index[name]
KeyError: <TextureRegion 64x64>

TextureImage  is erroneously trying to use resource to read theTextureRegion as if it were a file
I'm on Python 36.
Reply all
Reply to author
Forward
0 new messages