On Oct 8, 2005, at 2:26 PM, Carl Karsten wrote:

That was a great post. The rest of the thread isn't too bad either. Once I "get it" I'll boil it down into a wiki page. If some of my Q's seem like I am not paying attention, they are more "I think I know, but let me confirm" (like the first one.)

I'm not just replying to you, but to all the subscribers to this list who are still new to the concept of sizers and how they work.

No. Forms (and any other container) have a Sizer property that references the sizer that is used to determine the size/ position of its member controls.

Is there a 1:1 or 1:many relation between From and Sizer?

    Yes.

weights - new concept.  but I think I get it.  neat.

If there are 3 objects in a sizer, and they all have a weight of 1, then each will have 1/3 of the available space allotted to it. If one of those object were to have a weight of 2 instead, that's a total of 4 weightings, so the object with a weight of 2 would get 2/4 of the space, and the others would get 1/4 each.

Assigning an object a weight of zero, though, doesn't mean it gets no space. Zero-weighted objects are given the space that the object would naturally take without the effect of sizers; i.e., the default height or width for that control. After the space for the zero-weighted objects is allocated, the remainder is divided up among the weighted objects according to their weight.

Lets talk about the term collection. Is Collection a well defined term in the context of Dabo/Python?

Python's strongest feature, IMO, is its handling of lists/tuples/ dictionaries. Add to that list comprehensions, and you don't need a specialized class to do what is native in the language.

Example: I have several object references stored in a local attribute called 'bar' as a list. Let's say I want to get those objects in that list whose Foo property is greater than 42. The expression is:

gt42 = [obj for obj in self.bar
        if obj.Foo > 42]

    Mentally, I translate such expressions into SQL-like syntax:

select obj from self.bar
    where obj.Foo > 42
    into gt42

If you've been reading all the hubbub about Microsoft's new play in .Net, LINQ, and look at what it does, it really isn't all that different from list comprehensions, which is native Python at its finest.

for instance: "list of objects" seems to me to be a collection.

You can certainly think of it that way, but remember that just about everything in Python is an object. A method of an object is an object in and of itself, and can be passed around like any other object. There really isn't any distinction between a list of controls and a list of integers.

Did I mention this is whole sizer thing is pretty cool? It kinda crept in under my radar - maybe it needs a bit more air time, like a PyCon talk? (or do all the cool people know about this, and I am just showing my greenness?)

It's fairly common among wxPython folk, although many people don't take advantage of them. IMO, it's the only way to develop cross- platform, because if you use absolute positioning to make everything line up perfectly in Windows, and then run it on Gtk, it'll look like crap, due to differences in how each platform renders fonts and control shapes.


-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to