Home > OS >  How get widget size?
How get widget size?

Time:09-22

Is there a way to precalculate widgets size before grid it?

Let say you have a frame filled with a button and label with text.

The text inside the label can differ in length, which will give you different frame size.

CodePudding user response:

I missed those methods winfo_reqwidth() and .winfo_reqheight() in the doc.

req in winfo_reqwidth stand for "requested" which do the job of precalculating size

I tried with .winfo_x() before, but got a return value of 1.

  • Related