Why can't we get rid of sizers?

From: "Josiah Carlson" <jcarlson@uci.edu>

     self.newc = ...
     sizer.Add(self.newc)

Wow, that was a pain. I can't imagine how anyone manages to use sizers
to layout their controls.

Josiah, I hope you intended that playfully. As the level of sarcasm in that jab defies your normal professionalism and helpfulness on this list.

If all anyone ever did was align things in a straight line, then the above then the above would work and this thread wouldn't have come into existence.

But it gets a lot more complicated by just adding labels to those controls.

Then what if you want them in a hierarchy of grids and some to get bigger with resizing and some not. With static boxes around them. With various groupings of various sizes.

Sizers are a pain. They add unbearable clutter to otherwise simple code. And they often simply don't behave as expected.

And this is the worst criticism of all: *There is nothing about them to aid in debugging.* Something not sized right. Why? Which element is causing things to spill off the edge of the screen? Why is one group growing and another is not? Why is some group bigger than it obviously needs to be? No obvious way to find the answers to any of those questions.

End of rant.

(But not end of sizers being a pain. :slight_smile: )

Michael

> From: "Josiah Carlson" <jcarlson@uci.edu>

> self.newc = ...
> sizer.Add(self.newc)
>
> Wow, that was a pain. I can't imagine how anyone manages to use sizers
> to layout their controls.

Josiah, I hope you intended that playfully. As the level of sarcasm in
that jab defies your normal professionalism and helpfulness on this
list.

Indeed, I forgot the emoticon. I also forgot to finish the sentence in
a previous paragraph.

If all anyone ever did was align things in a straight line, then the
above then the above would work and this thread wouldn't have come into
existence.

What I was trying to say is that simple layouts are simple to do. But
complicated layouts are going to be complicated, I believe, regardless
of the tools one attempts to use to attack the situation. Right now,
you need to state how you want items to be laid out via sizers. But
once you've done that, you are done.

I understand that debugging layout can be a pain; I've spent uncountable
hours hacking away just to try to get layouts *just right*. Other users
have pointed out GUI designers that attempt to make such laying out
better, easier, whatever.

I have personally found that once I know what I want it to look like
(which is hard to figure that out without trying it, using paper cutouts,
etc.), actually laying it out isn't that bad (of course I also find that
BoxSizers are sufficient for 99.9% of the stuff I do).

But it gets a lot more complicated by just adding labels to those
controls.

Then what if you want them in a hierarchy of grids and some to get
bigger with resizing and some not. With static boxes around them. With
various groupings of various sizes.

Sizers are a pain. They add unbearable clutter to otherwise simple
code. And they often simply don't behave as expected.

And this is the worst criticism of all: *There is nothing about them
to aid in debugging.* Something not sized right. Why? Which element is
causing things to spill off the edge of the screen? Why is one group
growing and another is not? Why is some group bigger than it obviously
needs to be? No obvious way to find the answers to any of those
questions.

From what I remember, there is supposed to be a keyboard hotkey to
highlight sizer regions in wxPython 2.7 . I also described a method
using the Python 2.5 with statements along with some sample context
managers for handling layout, etc. Neither are a panacea, but both
could help people with GUI layout.

- Josiah

···

"Michael Hipp" <michael@hipp.com> wrote:

Josiah Carlson wrote:

From what I remember, there is supposed to be a keyboard hotkey to
highlight sizer regions in wxPython 2.7 .

It's what somebody here dubbed the "four finger salute," Ctrl-Alt-Shift-middleclick

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!