On Thu, 14 Jul 2011 13:57 -0700, "Michael Carius"
<[email protected]> wrote:
# Python 2.x code
class MySurface(object):
def __init__(self, obj):
if isinstance(obj, tuple):
self._surf = pygame.Surface(*tuple)
elif isinstance(obj, pygame.Surface):
self._surf = obj
def __getattr__(self, attr):
return getattr(self._surf, attr)
This looks the most promising, but I couldn't actually get it to
work. What I want to do, is add extra attributes to a
pygame.Surface object, such as pos and size, including _abs
attributes that find the position relative to the screen. I'm
using this in my GUI toolkit (which I talked about doing for GSoC
earlier in the year). You can see the current surface.py module
at
http://bazaar.launchpad.net/~dreamsorcerer/simplegc/trunk/view/he
ad:/sgc/surface.py
This works perfectly if I create a new surface by passing in a
tuple, but I'm not sure how to get the same effect by passing in
an existing pygame.Surface object.
Thanks,
Sam Bull