pickle saving pygame Surface (python) -


i tried save pygame.surface doesn't let me, error

typeerror: can't pickle surface objects

i can make save surfaces? or maybe there module can save ?

explanation:

a = pygame.surface( (5,5) ) file = open("hello", "w") pickle.dump(a, file) 

i have classes saves in them surfaces.

as monkey said: don't want pickle surface. if need save surfaces' content use pygame.image.save() function.

if prefer surface not actual image file (for whatever reason) use pygame.image.tostring() function lets convert surfaces' content stringbuffer.


Comments

Popular posts from this blog

Line ending issue with Mercurial or Visual Studio -

java - Jtable duplicate Rows -

java - Run a .jar on Heroku -