I have a Tkinter Toplevel window with three columns. All three columns are configured to have equal weight. Inside column 0
and 2
are sub-frames, inside which are Listbox
widgets. Inside column 1
is a set of buttons. For some reason, despite the fact that my 3 columns have equal weight, these Listboxes 'force' their columns to occupy more space.
I've written,
window.columnconfigure(0,weight=1) window.columnconfigure(1,weight=1) window.columnconfigure(2,weight=1)
But I get:
I've also given column 1
weights of 3 and 5, but it still remains small. However, having done this, it seems that columns 0
and 2
have some minimum size, then after subtracting that from the real width, the leftover width is used and divided by weight.
Is this a bug? Is there something I need to do to my lists? Might I be forgetting something?
It is not a bug. weight
determines how extra space is allocated. It doesn't make any guarantees about the size of a row or column.
If you want columns to have a uniform width, use the uniform
option and make them all be part of the same uniform group.
window.columnconfigure(0,weight=1, uniform='third')
window.columnconfigure(1,weight=1, uniform='third')
window.columnconfigure(2,weight=1, uniform='third')
Note: there is nothing special about 'third'
-- it can be any string as long as it's the same string for all three columns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With