On 13 mai, 10:04, manatlan <[EMAIL PROTECTED]> wrote: > On 12 mai, 18:57, Karlo Lozovina <[EMAIL PROTECTED]> wrote: > > > > > manatlan wrote: > > > I can't find the trick, but i'm pretty sure it's possible in an easy > > > way. > > > It's somewhat easy, boot looks ugly to me. Maybe someone has a more > > elegant solution: > > > In [6]: import new > > > In [13]: class Button: > > ....: def buttonFunc(self): > > ....: pass > > > In [14]: class ExtensionClass: > > ....: def extendedMethod(self): > > ....: pass > > > In [15]: hybrid = new.instance(Button, > > Button.__dict__.update(ExtensionClass.__dict__)) > > > In [17]: dir(hybrid) > > Out[17]: ['__doc__', '__module__', 'buttonFunc', 'extendedMethod'] > > > Seems to do what you want it to do. > > > HTH, > > Karlo. > > yes, i think it's the only solution ... it's weird > but it seems to be the only one ... > i will try that ...
in fact, the "new" solution adds methods to all "gtk.Button" and not a specific instance ... it's not good for me but thanks (i always forget the use of the "new" module for this kind of things) -- http://mail.python.org/mailman/listinfo/python-list