kath wrote:
> hi, Larry Bates .... thanks for the reply...
> 
>> You might consider doing it the same way wx passes things around.
>> When you instantiate the subclass pass the parent class' instance
>> as first argument to __init__ method.
> 
> Yes thats absolutely right..
> 
>> That way the subclass can
>> easily pass values back to the parent by using that pointer.
> 
> Could you please explain me this.. more clearly. I think it is much
> close to the solution.
> 
> 
> Thank you.
> regards, sudhir
> 
Just something like:

class foo:
    self.__init__(self, parent):
        self.parent=parent

class bar:
    self.__init__(self, parent):
        self.parent=parent
        self.foo=foo(self)


class myclass:
    self.__init__(self, parent):
        self.parent=parent
        self.bar=bar(self)

Now in foo I can reference things from myclass easily
self.parent.parent.  Or setattr(self.parent.parent, value).

Hope this helps.

-Larry
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to