[Tutor] Multiple inheritance - solved

Alan Gauld alan.gauld at yahoo.co.uk
Sat May 15 09:10:08 EDT 2021


On 15/05/2021 06:46, Phil wrote:
> On 14/5/21 10:18 pm, Alan Gauld via Tutor wrote:
> 
>> class MyForm(wx.Frame):
>>     def __init__(self, aMeter,....):
>>        wx.Frame.__init(....)
>>        self.meter = aMeter
>>        .... as before
> 
> It finally dawned on that "= Meter" should be "= Meter(200)".

notice I did not write

= Meter

I wrote

= aMeter

In other words, the argument passed to __init__().

To pass the Meter(200) you would  write

myform = MyForm(Meter(200), ...other args....)

If you assign Meter(200) inside init you always get
the same Meter values.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list