[Twisted-Python] wxpython and xmlrpc via twisted

Jean-Paul Calderone exarkun at divmod.com
Wed Dec 10 10:04:06 MST 2008


On Wed, 10 Dec 2008 08:54:49 -0800, Ian Jones <ian at ambientdivide.com> wrote:
>"There's probably no good reason to subclass both of these"
>
>I'm relatively new to python so sorry if this should be obvious - but
>how else would I get the functionality of both classes if I did
>subclass both of them?

Create two classes and let instances of one keep references to an instance
of the other.  For example, in this case, you might have a wx.App subclass
with the OnInit method defined in the example and a different XMLRPC
subclass with a reference to instances of the first class.  Then, instead
of doing `self.frame.Close()´ or `self.frame.SetTitle(x)´, it would do
`self.appObj.frame.Close()´ or `self.appObj.frame.SetTitle(x)´.

Jean-Paul




More information about the Twisted-Python mailing list