Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Temporary images with Pyglet

Tags:

python

pyglet

Is there a way to make a temporary "image" with Pyglet? (Something akin to LÖVE's Canvas).

Basically, I want to have an object that I could blit stuff like sprites and text to, and then blit this temporary image to the window.

I tried creating an image with pyglet.image.create(), but apparently it procures an ImageData which you can't blit to.

Thank you very much for your attention.

like image 229
art-solopov Avatar asked Aug 28 '17 19:08

art-solopov


1 Answers

Checkout AbstractImage. It has all the methods I think you want - creating an image offline, blitting stuff to it:

myimage.blit_into('sprite1',x,y,z)
myimage.blit_into('sprite2',x+20,y,z)

and then blitting it to the active frame:

myimage.blit(x,y[,z])

etc.

like image 107
kabanus Avatar answered Nov 08 '22 16:11

kabanus