Reputation: 804
Say I have a Frame
in tkinter with a set width and height (placed using the place
method), and I add a child Frame
to that parent Frame
(using the pack
method). In that child Frame
, I add an arbitrary amount of widgets, so that the child Frame
's width is dynamically set depending on its children.
My question is how do I get the width of the child Frame
if it's width is greater than its parent?
I know there's a winfo_width
method to get the width of a widget, but it only returns the width of the parent Frame
if its width is greater than its parent. In other words, how do I get the actual width of a widget, not just the width of the part of the widget that is displayed?
Upvotes: 2
Views: 340
Reputation: 385970
The width will never be bigger than the parent frame.
You can call winfo_reqwidth
to get the requested width of the widget. I'm not sure if that will give you the answer you are looking for. I'm not entirely what the real problem is that you are trying to solve.
Upvotes: 2