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

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -