On Friday 20 November 2009 09:48:38 am Alan Gauld wrote: > "John" <jfabi...@yolo.com> wrote > > > class A (wx.Panel); > > def__init__(...) > > > > class B(wx.PyPanel): > > > > def __init__(..): > > self.pages = A(...) > > > > class C (B) > > def __init__(...) > > > > I can't change the code in either class A or class B. But I want to add > > a > > property to class A in class C. Is that possible? > > You need to distinguish between classes and instances thereof. > > You can add attributes to instances of A, and you can access the > instance because it is stored in self.pages of C. (You can actually add > attributes and methods to the class too, after it is defined but I wouldn't > recommend that since it gets very confusing if you duplicate a name > added to an instance elsewhere!) > > So you can, within C's methods do > > self.pages.foo = 66 > > which adds a new foo attribute to the instance of A stored in pages. > Just be careful you don't have any code anywhere that relies on the > content of A instances (eg pickle/unpickle type things). > > > wxpanelFontSize = property(_getwxpanelFontSize, _setwxpanelFontSize, > > None, '') > > Sorry, the connection to A is not clear.
Thanks - for your help. Johnf _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor