up with PyGUI!

Ed Leafe ed at leafe.com
Sat Sep 25 17:08:49 EDT 2004


On Sep 25, 2004, at 7:47 PM, OKB (not okblacke) wrote:

> Well, I see what you mean, but conversely, even in the example you
> gave above, it seems to me that the "def __init__" is (or should be)
> superfluous.  The very fact that you are defining a button inside a
> panel clearly indicates that you want the button to be added to the
> panel.  Restating this information repeatedly with an __init__ and self
> references and explicit "add" methods is cumbersome.

	Actually, I just used the __init__() method because that would be more 
familiar to most Python folk. Dabo has a method named afterInit() that 
is designed for things such as adding contained objects, so that 
__init__() is available for the usual instance initialization stuff.

	I guess I don't see how this is any more cumbersome than creating 
ersatz "class" definitions in an attempt to avoid writing explicit 
code. In my form, I want 5 controls added, and I want particular 
properties set on each. So there are 5 addObject() commands, and just 
as many lines setting props as necessary. You would write 5 class 
definitions, each of which has just as many lines setting props within 
that class definition. The only difference that I can see is yours 
relies on an implicit technique to actually add the objects to their 
container, while mine uses an explicit one.

      ___/
     /
    __/
   /
  ____/
  Ed Leafe
  http://leafe.com/
  http://dabodev.com/




More information about the Python-list mailing list