Kevin Ollivier wrote:
I think I probably didn't explain myself well.
Much better this time. I know you well enough that I expect your ideas were good ones.
I think you've focused on a good point here: there are three independent hierarchies used when building an UI:
The Python class hierarchy (subclass, superclass)
The wxWindow hierarchy (parent, child)
The Sizer Hierarchy
This does make things confusing -- can we at least get rid of one?
1) Creating HIG compliant apps with proper borders/padding is currently a pain (you have to read the HIGs yourself and then code your sizers accordingly), and
That could be better. I'm not sure we need to do anything really different structurally, just add some more defaults, maybe even smart ones: A Button gets an n pixel border, a TextCtrl gets an m pixel border, etc.
2) Using sizers in visual GUI builders is rather awkward, and it may even be true to say the current implementation limits how close to RAD a wxPython GUI builder can get.
Personally, I'd like layout to be easier to code by hand, then I think the GUI builders would be easier too.
You can't do that with wxPython GUI builders when using sizers, because you need to give that window a sizer first before you can add the control. In other words, for wxPython, creating a sizer to hold controls is always step one in GUI building, not "adding controls", which is step one in other editors.
Couldn't the editor do it for you anyway? though, as I said, I want the code to be easy to write too.
> By making controls always have a sizer, we can internalize
some sizer code, e.g. adding controls to their parents' sizer, into wx itself meaning that users and GUI builders automatically get this behavior 'for free'.
Hmm. I still don;t see how it makes sense for a control to have a sizer, unless it's a container control, like a wxPanel. (Doesn't MindWrapper do something like this? and/or Dabo?) However, controls could have sizing properties, that get used by the sizer. Essentially these would be all the parameters and flags that get passed in to the Sizer.Add() method.
Another thought I had was to simplify the difference between horizontal and vertical sizing, when do you have to know if you use the "option" parameter or a wx.GROW? Why not:
StretchFactorVert = 3
StretchFactorHoriz = 0
Then that would work in either a horizontal or vertical box sizer (and grid sizers)
Another thing I often thought: BoxSizers are just special cases of grid sizers. In fact, I think you could really have only GridBagSizer and everything else is a special case.
The only real trick here that I see at first is that some layouts (quite a few, really) need nested sizers. If there is one sizer per Panel object, how do you do nested sizers? Nested Panels? maybe. It seems like extra Panels, but maybe that's not a big deal.
A nice side-benefit for users who code their GUIs by hand is that much of the tedious coding is gone -
Now that I like!
Now we need someone to prototype this up....
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov