winfo reqwidth

winfo reqwidth window

Returns a decimal string giving window 's requested width, in pixels. This is the value used by window 's geometry manager to compute its geometry.

MGS [2003/09/16] - Note that when you un-manage or destroy the child of a frame (for instance), the requested size of that frame does not reduce:

  % frame .f -width 0 -height 0
  % label .f.l -text "Hello World"
  % pack .f.l
  % winfo reqwidth .f
  % .f.l configure -text "Hello"
  % winfo reqwidth .f
  % pack forget .f.l
  % winfo reqwidth .f

In order to reset the requested size of the frame, just configure its -width to 1 and then 0:

  % .f configure -width 1
  % .f configure -width 0
  % winfo reqwidth .f

The same technique works for the requested height too.