[Tutor] passing arguments via an instance of a class

Alan Gauld alan.gauld at btinternet.com
Thu Apr 5 01:25:29 CEST 2007


"Che M" <pine508 at hotmail.com> wrote

> > >def OnButton1Button(self, event):
> > >        self.weightplot = 
> > > PlotPanel(self.notebook1,xpoints,ypoints)
> >
> >But this needs to use self to access the member values:
>
> Doing it this way didn't work--it gave the error:
> because, I think, self in this case refers to the whole frame,

Exactly right, this is what Kent pointed out. I had not noticed
the fact that this was a method of the GUI Frame rather than
of the PlotPanel.

> To summarize

You got it exactly right.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list