On 12/08/11 09:48 AM, Lenard Lindstrom wrote:
On 12/08/11 12:06 AM, Ian Mallett wrote:
Anyway, "data", in this case, is a surface, but, consistent with
Python's duck-typing awesomeness, it can be a string or NumPy array,
and maybe a few other things too. Now that I know what the problem
is, I need to fix it. "self.data" really can't be linked in any way
to the input data "data". How do I do this (consistent for several
data types, but, chiefly, surfaces)?
Hi Ian,
I data a regular, or OpenGL, surface? As for copying, Surface.copy()?
Sorry, forgot you want to do a generic copy. Anyway, copy.copy works
fine. It looks like a Python bug with copy.deepcopy. It too should just
call the __copy__ method when no __deepcopy__ is present. Instead it
seems to use __new__, which for Surface returns a dead surface. The
documentation on deepcopy is incomplete; supporting it is not a
priority. But a feature request can be added to the issue tracker at
Pygame's future development home at http://Bitbucket.org/pygame/pygame .
Lenard Lindstrom