[Tutor] which gets called
John Fabiani
johnf at jfcomputer.com
Fri Apr 6 18:45:26 CEST 2012
On Friday, April 06, 2012 06:54:28 AM John Fabiani wrote:
> Hi,
>
> I want to create a class that inherits two other classes.
>
> class NewClass( A,B)
>
> But both "A" and "B" contain a method with the same name ("onKeyDown").
>
> If my "NewClass" does not contain something to override the methods which
> one would be called if
>
> myinstance = NewClass()
>
> myinstance.onKeyDown()
>
>
> Second to insure the right one is called is it possible to do the following
>
> NewClass(object):
>
> def onKeyDown(self, event):
> b.onKeyDown(event)
>
> Johnf
Thanks guys!
The class I'm creating is inheriting from classes I did not create. And of
course the inherited classes are from different authors. So I'm attempting to
create a wrapper and the problem comes from the keyboard events. Each of the
classes has a onKeyDown method and I only want one to work and then pass the
data to the second.
But you have helped (along with the links). And I have successfully got the
right method called. The issue is now getting the second (B) to fire
correctly.
Johnf
More information about the Tutor
mailing list