orthogonal hierarchies

Chris Barker wrote:

One question I do have, however, is that there are some layouts
of widgets that you just can't do without nested sizers. I
suppose you could do it with nested Panels, like you have, but
then you have the namespace problem. If widgets in one panel
need to interact with widgets in another panel, you have added
complication. Or is that what a "subpanel" does for you?

Yes, you surmised correctly. Subpanels are essentially sizers and
can be nested to any depth within a panel. This feature does not
actually help with the namespace issue, but I set it up this way
thinking that nested subpanels (sizers) should be more efficient
than nested panels. I honestly cannot tell much difference.

I'll concede that using my approach requires thinking up a lot of
different names, but I deal with namespace clutter and collisions
in two ways. First, I keep my modules fairly small and only import
selected (top level) names. Second, sometimes in a complicated
panel I nest the class definitions, so that the same set of names
can be used in two or more different locations.

As far as widgets interacting with other panels, there is a set of
introspection methods such that it is easy to get the containing
frame, and dot notation works well after that.

For example, in your Demo-2, you have a subpanel with the OK and
Cancel buttons on it. I would usually bind those button events
in the Dialog, as they effect the whole dialog. How does that
work here?

In the case of the button event handler, it could have been defined
in the dialog class and bound with:

command = self.get_frame().on_ok.

In this case, however, the action is not somuch related to the
dialog as to the database found at self.get_app().db.

Also, have you looked at PythonCard at all recently? The
high-level goal of making wxPython more pythonic and easier
to use is the same, if they could just get sizers working,
they'd have a really nice tool. You've done a great job of
simplifying the sizers issue, so maybe there is room for
collaboration.

I've followed PythonCard pretty closely, but so far I've not
figured out a way to merge the two ideas. I spent a lot of time
early on looking at different kinds of notation, and I was unable
to find a way to get the PythonCard notation to work with adding
windows to sizers automatically.

Regards,
Donnal Walter