Top-level window geometry
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?) ======= Question#2: the x=0, y=0 position is ignored when the root and the canvas are displayed. Why??? ======== #============================== from Tkinter import * root=Tk() root.geometry('600x400+0+0') #why??????? print root.winfo_geometry() canvas=Canvas(root,bg='green') canvas.pack()
Hi Gabor: On Mon, Nov 17, 2008 at 6:08 PM, Gabor Kalman <Kalman_G@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
participants (2)
-
Gabor Kalman -
Michael O'Donnell