[General lang] how to call a parent
John Fabiani
jfabiani at yolo.com
Sun Jun 15 19:01:46 EDT 2003
I'm just starting to use python and playing with the tools and the language.
After building a few small windows (via BOA) I realized that I did not know
how to create a class that allowed reuse in a general way. I was testing
how classes are used. I was able create properties, call the __init__ of
the parent class .etc But then I realized I did not have a way to call a
parent of control - such as a container. Also I was not aware of "super".
I'm guessing that will help. Still learning!!!!!!!!!!!!
John
Aahz wrote:
> In article <F%0Ha.261$WW3.30765151 at newssvr21.news.prodigy.com>,
> John Fabiani <jfabiani at yolo.com> wrote:
>>
>>I'm a newbie to the Python world but not programming. In the Visual
>>Foxpro world we have the concept of ?parent?. I normally use it to
>>set properties of a custom control as in ?parent.background.color =
>>blue?. The parent in this case is a container. In the VFP world we
>>have ?thisform, this, and parent? and all class methods are run unless
>>overwritten by the child class. Anyway, I'd know how to call the
>>parent of an object. BTW if I'm all wrong with this idea would someone
>>explain why!
>
> It's not that you're all wrong as that what you're describing is a
> special form of object protocol that primarily applies in GUI design.
> You can certainly perform this kind of operation in Python, but unless
> you're using a framework, it's not automatic. Before I (or other
> people) give you specific advice about the best way to implement this,
> it'd be good if you gave us more information about what you're trying to
> accomplish.
--
John Fabiani
More information about the Python-list
mailing list