Re: [pygame] Re: Extending Surface Class
I got here too late for the self answer, but I wanted to add: In case you haven't heard of pygame Sprite()'s Depending on what you're' doing, it might be more usefulll to derive pygame.sprite.Sprite() [ which is a Surface, and Rect ] But also allows you to use sprite groups. ] You can think of them to be similar to shared pointers, in that if the sprite is in any group, it stays alive, since there is a reference to it. http://www.pygame.org/docs/tut/SpriteIntro.html http://www.sacredchao.net/~piman/writing/sprite-tutorial.shtml -- Jake
[pygame] Re: Extending Surface Class
Oh thanks for the translation :) Well, the whole point was to make the process automatic, and my program not even know that the class was different, so a wrapper attribute kind of defeats the purpose. It's alright, though, I can just live with the standard Surface __str__(). No biggie. Thanks for the help, though, guys!
Re: [pygame] Re: Extending Surface Class
By wrapper, he means writing a python class that has an internal member, _sruf, which is the surface in question. Then you can override the __str__ function with your own. Otherwise, you just call _sruf's own methods and attrs -Tyler On Sat, Jul 25, 2009 at 2:48 PM, ERName wrote: > Well, I appreciate your reply, but I don't really understand what you > mean by "wrapper"... and this mysterious _sruf attribute? > > The part about being a C object I understand, though, and I was afraid > of that. If there's not any easy way of doing this, I can just live > with the default __str__(), I guess. > -- Visit my blog at http://oddco.ca/zeroth/zblog
[pygame] Re: Extending Surface Class
Well, I appreciate your reply, but I don't really understand what you mean by "wrapper"... and this mysterious _sruf attribute? The part about being a C object I understand, though, and I was afraid of that. If there's not any easy way of doing this, I can just live with the default __str__(), I guess.