art-solopov
art-solopov

Reputation: 4775

Temporary images with 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.

Upvotes: 13

Views: 796

Answers (1)

kabanus
kabanus

Reputation: 26005

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.

Upvotes: 1

Related Questions