[Tkinter-discuss] Top-level window geometry

Michael O'Donnell michael.odonnell at uam.es
Mon Nov 17 18:47:37 CET 2008


Hi Gabor:

On Mon, Nov 17, 2008 at 6:08 PM, Gabor Kalman <Kalman_G at msn.com> wrote:
> In the code-snipet below, the following is printed as output:
>
> 1x1+0+0
>
> Question #1:    why???   (is this somekind of a "normalized" or "per-unit"
> output?)
> =======

A window has default geometry (basically  1x1+0+0) until it is
actually displayed. Your root window is not yet displayed
at the point at which the print statement is executed.

Try the following, which forces pending drawing events to be
performed before the second print (with update()):

from Tkinter import *

root=Tk()
root.geometry('600x400+0+0')   #why???????
print root.winfo_geometry()
root.update()
print root.winfo_geometry()


Mick


More information about the Tkinter-discuss mailing list