[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Pickling?



I thought there used to be a UserRect to make rects more flexible, but
it seems to be missing from the current pygame docs on pygame.org...

Did I imagine it, or was it removed?

On Sun, 2003-02-23 at 14:42, Gerrit Holl wrote:
> Hi,
> 
> I am trying to save a game. Is pickling Sprites supposed to work?
> When running my game with python -i and checking stuff afterwards,
> I get:
> 
> >>> sprite.__dict__
> {'image': <Surface(40x40x16 SW)>, 'rect': <rect(1042, 931, 40, 40)>, '_Sprite__g': {<Group(111 sprites)>: 0, <RenderUpdates(152 sprites)>: 0}}
> >>> sprite.__reduce__
> <built-in method __reduce__ of Lolly object at 0x401d9b2c>
> >>> cPickle.dumps(sprite)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> cPickle.UnpickleableError: Cannot pickle <type 'Surface'> objects
> 
> sprites *seem* to have a __dict__ and __reduce__, which *should* be
> enough to pickle it, or shouldn't it?
> 
> yours,
> Gerrit.

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org