[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Surface objects



I dont understand well what are you wanting to do, a wrapper?

Do a class that inherits Surface and that contains a Surface.

Do implement all the methods callables of the object and say them to
do in inside's surface, a simple example will be:

class A:

    def __init__(self):
        print "init A"

    def sayHello(self, param=""):
        print "Im A class" + `param`

    def anothermethod(self,params):
        #dostuff

class B(A):
    A a = A() //B class IS a A and HAVE an A

    def __init__():
        A.__init():

    def sayHello(self, param=""): //overwrite the ALL methods and
rewrite them or only call A's analog method with its params
        print "Im a B and also"
        self.doALotOfStuffBeforeSayHello()
        a.sayHello(param)

   def anothermethod(self,params):
        self.a.anothermethod(params)

   def doALotOfStuffBeforeSayHello(self):
       .....

b = B()

wil print:

init A
Im a B and also
Im A class

Is that what you wnted?