Il giorno mar, 03/01/2012 alle 17.41 +0100, Jérôme ha scritto: > Tue, 03 Jan 2012 16:34:37 +0100 > Pietro Battiston a écrit: > > > So if there is no left/right alignment rule, the default is just to > > distribute them on all the available space, leaving the same empty space > > among them or, if you instead set "homogeneous", allocating to each the > > same space, which will then possibly be partly empty. > > > > Your logic could make sense, it is just based on more assumptions. > > The GTK3 docs says : > http://readthedocs.org/docs/python-gtk-3-tutorial/en/latest/layout.html#boxes > > "If homogeneous is True, all widgets in the box will be the same size, of > which the size is determined by the largest child widget." > > That's why I would expect homogeneous to mean widgets (for instance buttons) > of same size, regardless of expand, as I described in my previous message. > > This description does not seem to fit reality. In practice, we saw that when > homogeneous is set, the N widgets are provided one Nth of the total size, > though they don't necessarily fill that space, and this size does not depend > on the largest child widget.
Yes, you're right, strictly speaking the docs are wrong: widgets are _allocated_ the same size, they wont't _be_ the same size. That said, it is clear that that sentence from the doc _couldn't_ be right, because a widget has the "power" to not expand and hence the Box couldn't determine its true size anyway: it can only decide how much space to allocate to it. > > Well, thinking of it, it does, if the total width is determined by the > widgets, which happens if the HBox is the largest. This is not true if it > belongs to a VBox with larger HBoxes in it, of if I enlarge the window, for > instance. > > > I anticipate that your reaction will be "but those are ugly hacks", > > But those are ugly hacks ! > > > and I guess - but again, I might be wrong - the answer of the developers > > would be "what you're trying to do is ugly". > > Is it ? Perhaps. > > I had the feeling that the logic I exposed allowed more things to be done > with the same amount of parameters. I must be wrong, since people have been > working on it much longer than I did. I just don't see why. You seem to be right on this too: your rule could apparently allow more things. And in fact, my sentence is exagerated: certainly what you want to do is not necessarily "ugly" (and in fact, the solution by craf is less ugly than the one by me), Let's just say that: 1) I'm not sure what you see as a "sane" rule still looks so obvious when we stop assuming that all children share the same flags (not to mention the fact that in a table we have the same problem in 2 dimensions, and we expect a behaviour coherent with onedimensional GtkBoxes) 2) the gtk libs seem to not favour what seems to not be considered as a logic default: if there is no _logic_ difference between widgets on the left and on the right, then they should be nicely distributed on all the available space, while if they are logically different then they will be separated in different containers (and at this point, GtkFrames are probably even better suited than nested GtkBoxes). bye Pietro _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
