[Q] sub-methods ?

Greg Krohn ('rot-13') 'tert at pncen.hf'.decode
Mon May 19 01:16:52 EDT 2003


"Arsenal" <arsenal_hl at yahoo.com.hk> wrote in message
news:e305e171.0305182024.f274d35 at posting.google.com...
> 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?

I haven't looked at the source, but probably not.

> Why it seems
> there are some "sub-methods" like AsIs(), SameAs() behind it?

In Python, everything is an object. Objects can contain other objects (or
have
sub-objects if you prefer). So, 'height', 'width', etc. are objects special
to
wxPython. They contain an 'AsIs' method.

>
> I am sure i have got something wrong, would anyone pls enlighten me
> :) ?
>
> Thanks!

Yes. No problem.

greg






More information about the Python-list mailing list