The pyglet.gl
module does not define any variable texture
, so your import statement in line 2 does not provide anything like that. And what do you even expect it to contain? You'll need to create your Texture
object yourself.
To do so, you could use the methods pyglet.resource.image
or pyglet.resource.texture
or you could load an AbstractImage
by calling pyglet.image.load
and retrieve a corresponding Texture
object by accessing the image's texture
member or, say, adding it to a TextureAtlas
.
Why don't you add to your code:
img = pyglet.image.load('imagefile.png')
texture = img.texture
and don't forget to alter your vertex_list
accordingly to make use of the texture.