On 6/14/10 10:35 PM, rantingrick wrote: > On Jun 14, 11:08 pm, Stephen Hansen <me+list/pyt...@ixokai.io> wrote: > <snip> > >> Does not perform to spec. Quote, "Inside of A, there are four items in a >> vertical line. The bottom which takes up half of the total vertical >> space, and the top three share the rest. > > No problem, check this out... > > import Tkinter as tk > app = tk.Tk() > app.geometry('400x400+20+20') > # Left > tk.Label(app, text='C', bg='red', width=20).place(rely=0.0, > relheight=0.1667, width=200) > tk.Label(app, text='D', bg='blue', width=20).place(rely=0.1667, > relheight=0.1667, width=200) > tk.Label(app, text='E', bg='green', width=20).place(rely=0.3333, > relheight=0.1667, width=200) > tk.Label(app, text='F', bg='white', width=20).place(rely=0.5, > relheight=0.5, width=200) > # Right > tk.Label(app, text='G', bg='purple').place(x=200, rely=0.0, > relheight=0.333, relwidth=1) > tk.Label(app, text='H', bg='orange').place(x=200, rely=0.3333, > relheight=0.777, relwidth=1) > app.mainloop()
Very good. However, you're now doing a lot of complicated manual placements and numbers. Just noting this for the record. > However *your* code does not perform to your own spec! You said > this... >> Inside of B, G is one third the size of H. > > If you mean that G should be one-third the "height" of H then your > code (and yes i have the new version that does not blow chunks!) does > not follow this spec! Better re-check my friend. ;-) No, my code goes to spec-- though I concede the point that the spec may not have been stated clearly. Your code has the total height of B(the entire right column) being X; and G is one third of that total height, while H is 2/3'ds of it. That's close, but very specifically not what I was going for. I was going for B having a total height of "X"; and that H is 300% the size of G, as demonstrated in the following: http://ixokai.io/get/layout-results-comparison.jpg You should be able to see that your "G" is half the size of "H", where mine is one third of its size. If you dispute this assertion, I can provide exact measurements to demonstrate, but it should be visually clear. But, that said: You're very close, close enough to satisfy the challenge. But that's an easy one. I now present you the following alterations to the existing spec: - A must be a set, fixed size of 100x20. - H must expand fully, but maintain its aspect ratio. Now, in addition, in my code I made it so I could add as many new items to the top half of the left-column, and not require any tweaking of other things. This way, it can elegantly be expanded. The "F" panel which must be the bottom 50% doesn't ever need to be modified-- I simply add more things to the top half and it adjusts accordingly. A few tiny modifications to the existing code is at: http://ixokai.io/get/layout-wx2.py_ And the image is: http://ixokai.io/get/layout-results-wx4.jpg -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/
signature.asc
Description: OpenPGP digital signature
-- http://mail.python.org/mailman/listinfo/python-list