How to get a frame's size
Fredrik Lundh
fredrik at pythonware.com
Sun Mar 18 04:02:42 EST 2001
John Shankland wrote:
> I have a frame called IndexCard1 with some widgets packed in it. I want to
> make several of these and put them in a grid. I need to know how many I can
> fit on the screen, so I need the size of the frame. I'm able to get the
> dimensions of the screen okay, but IndexCard1.winfo_width() seems to always
> return 1. As do all of the other size related methods I could find. So my
> question is how do I get the size in pixels of IndexCard1?
winfo_width() returns the current managed size; it's updated
when Tk gets around to do geometry management. you can
use update_idletasks() to force geometry management.
winfo_reqwidth() returns the current requested size.
Cheers /F
More information about the Python-list
mailing list