[Q] sub-methods ?
Chris Lawrence
chris at lordsutch.com
Mon May 19 00:58:58 EDT 2003
In article <e305e171.0305182024.f274d35 at posting.google.com>, Arsenal wrote:
> Hello all,
>
> I am new to python. I am reading a chapter on wxPython, it has the
> following example.
>
>===========
> wc = wxLayoutConstraints()
> wc.height.AsIs()
> wc.left.SameAs(someButton, wxLeft)
> wc.width.PercentOf(parentPanel, 50)
> myButton.SetConstraints(wc)
>===========
>
> I am puzzled by the these.
>
> wc is an object instance.
>
> Aren't "height", "left", "width" themselves methods? Why it seems
> there are some "sub-methods" like AsIs(), SameAs() behind it?
Not knowing much about wxPython: "left" etc. are instance attributes,
not methods. These attributes are themselves instances, so you can
call methods (AsIs, SameAs) on them.
In a nutshell:
wc - Instance of wxLayoutConstraints
wc.left - "left" attribute of wxLayoutConstraint, instance of wx??
wc.left.SameAs - bound method of wx??
Chris
--
Chris Lawrence <chris at lordsutch.com> - http://blog.lordsutch.com/
More information about the Python-list
mailing list