Inheritance and recursion problem

Fredrik Lundh fredrik at pythonware.com
Sat Nov 25 03:56:33 EST 2006


Spiro wrote:

> XWindow have all drawing functionality and Windows[] object which holds 
> all child windows.
 >
> Function Draw looks like this:
> def Draw(self):
> 	self.Back.blit
> 	for wnd in self.Windows:
> 		wnd.Draw(OffsetX, OffsetY)
> 
> Now in main module i make objects:
> RootWindow=XWindow()
> MW=XMainWindow()
> RootWindow.Widnows.append(MW)

just a guess: you've written

     class XWindow:
         Windows = [] # class attribute, shared by all instances

instead of

     class XWindow:
         def __init__(self, ...):
             self.Windows = [] # create new instance attribute

</F>




More information about the Python-list mailing list