-
-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Label does not align to BOTTOM #828
Comments
In this case, Toga is doing exactly what it's being asked to do in this case; however, I can totally see why it would be confusing. What you've defined is a box, that contains a label; and you've specified that the label is to be at the bottom of it's containing box. The box is set to contain it's content vertically (i.e., as a column). The catch is that the label has a fixed height, based upon the size of the text for the label itself. In addition, the alignment attribute applies to the children of the element; so in this case, alignment is doing nothing. So: the layout allocates a 640x16 box for the label (all the available width, and the required fixed height); and then packs that the label the outer box. The net effect is that even though the window is larger, the outer box is only 640x16, and the text appears at the top of the screen. What you need in your layout is an element that will expand vertically:
In this layout, the spacer provides an element that can expand vertically, giving Pack a reason to put content at the bottom of the box. There's no need for an alignment style; the label is pushed to the bottom because the spacer is set to flexible expansion. Also, note that (a) the parent doesn't have a Arguably, the spacer shouldn't be required. The underlying issue in your original design that it requires the layout to expand to all the available space, not shrink to the minimum available space. This would be the equivalent of setting However, Pack doesn't currently have a concept of "100%"; and even then, it would require either an outer box, or the ability to set the height of the "root element". The current root element handling is the same as it is in HTML (by design). If you try to reproduce this layout in HTML flexbox, you'll find that you need 2 layers of boxes to get full page height expansion (or, set |
Thanks for the help! The spacer box solved the problem. If you want, I can think of a way to implement Pack(height="100%") What do you think? |
The difficult part isn't the syntax - it's the interpretation. Pack has very deliberately avoided issues like percentages because they're complex to implement when combined with fixed measures, flexible measures, etc. Pack exists mostly as a stop gap measure until Colosseum can be rolled out; both Pack and Colosseum build on Travertino which provides primitives. Given that viable workarounds exist, I think I'd rather see effort go into making Colosseum useful, rather than trying to making Pack more complex. |
No problem, closing the issue. |
The expansion of the root box to 100% of the window was implemented in #1778. However, the above comments are based on a misunderstanding of how |
I'm trying to show a label on the bottom of the window, but instead, It's showing up on the top.
I made a demo app and the same problem occurs. Here's the demo:
I am using python 3.7 on windows platform using latest toga version (pre-release)
The label "HI" appears on the top center of the window. any help would be much appreciated!
The text was updated successfully, but these errors were encountered: