pickle saving pygame Surface (python)

前端 未结 1 556
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-18 12:06

I tried to save a pygame.Surface but it doesn\'t let me, error

TypeError: can\'t pickle Surface objects

I can make it save surfa

1条回答
  •  时光说笑
    2020-12-18 12:38

    As monkey said: You don't want to pickle a surface. But if you really need to save that surfaces' content than use the pygame.image.save() function.

    If you prefer your surface not to be an actual image file (for whatever reason) you could use the pygame.image.tostring() function which lets you convert the surfaces' content into a stringbuffer.

    0 讨论(0)
提交回复
热议问题