[Tutor] Tkinter grid layout question
Phil
phillor9 at gmail.com
Sat Oct 28 20:02:56 EDT 2023
On 28/10/23 22:09, Alan Gauld via Tutor wrote:
>> |-------------------| |------------------|
>> | | | frame 2 |
>> | image | | |
>> | | | X |
>> | 250 x 230 | | X X |
>> | | | X |
>> | frame 1 | | |
>> |-------------------| |------------------|
> Unfortunately that hasn't worked.
So I see. It was correct at the sending end and it sort of demonstrates
the interaction of the button group layout with image to group's left .
Except that the button layout was mangled vertically and not
horizontally. If you copy my diagram to a text editor and move the
vertical characters so that they are in line vertically then you'll see
two frames and a button group.
>
> Can you strip out all code except the UI layout and just
> post it, that might be simplest.
There really isn't any other code, it's just one app class and nothing
else. It amounts to 96 lines.
>> Using two frames is a far better approach which worked
>> without any editing at all. Just a bit of copying and pasting
>> from the original code.
> Again, I'm not sure how that would work.
I'm more confident now that using two frames is the best and simplest
method. The image is displayed in one frame and the button group is
displayed in the second frame. There is no interaction between the
frames. The image can be increased or reduced to any odd size,
vertically or horizontally, without any movement of the buttons in the
other frame. Just using one frame for the buttons or the image would
probably work just as well.
>> By the way, each button is 50 x 50 and not the usual rectangular shape.
> That shouldn't be an issue.
I was just remarking that the button group size is a multiple of the
image's vertical size but not the same size. I found that by reducing
the size of the image by about 1/8 then the buttons returned to their
desired layout.
Anyway, the two fame method works perfectly and I think this thread
should probably be closed for the sanity of others. Thank you again Alan
for your time.
--
Regards,
Phil
More information about the Tutor
mailing list