Geometry option in Tk()

Sam Marrocco samSPAMMENOT at
Mon Feb 10 05:45:24 CET 2003

Jeff Epler wrote:
> The caveats that you'll see in the 'winfo height' and 'winfo width' section
> of winfo(n) also apply to 'wm geometry':
>        winfo width window
>               Returns a decimal string giving window's  width  in
>               pixels.   When  a window is first created its width
>               will be 1 pixel;   the  width  will  eventually  be
>               changed  by  a geometry manager to fulfill the win­
>               dow's needs.  If you need the  true  width  immedi­
>               ately  after  creating  a  widget, invoke update to
>               force the geometry manager to arrange  it,  or  use
>               winfo  reqwidth to get the window's requested width
>               instead of its actual width.
> Jeff

Hmmm....Okay, I think I can make that work by using the update() call first.

But--when I manually (resize) the toplevel window with a mouse, none of 
those methods (winfo_geometry, winfo_width/height) work correctly. They 
still return the originally set size of the window--even after the user 
has resized it. Placing update() calls after the resizing and before 
reading the attributes still doesn't return the correct size values.

Sam J. Marrocco
Sr. Visual Effects Artist/R&D
Travelling Pictures/GTN
Inferno, Flame, Houdini, Maya, All that cool stuff!
"The fact that no one understands you doesn't make you an artist."

More information about the Python-list mailing list