TK: Ho to set window position

andrea valle andrea.valle at unito.it
Thu Oct 28 05:39:21 EDT 2004


Thanks a lot

> First, according to Tkinter terminology, a frame is not a window. A 
> window is called a Toplevel

Sorry, I was in a hurry...

Could you please tell me where to find a complete reference for 
Tkinter? Maybe from a Tk site?
Thanks

-a-


> So, once you have your Toplevel instance, the method 
> positionning/sizing the window is calledgeometry, to which you pass a 
> string formatted like '[WxH][+X+Y]', where W and H are the width and 
> height you want for your window, and X and Y its coordinates. Example:
>
> >>> from Tkinter import *
> >>> root = Tk()
> >>> root.geometry('200x150')
> ''
> >>> root.geometry('+10+10')
> ''
> >>> root.geometry('300x200+40+80')
> ''
>
> The first root.geometry sets the window's dimensions only, the second 
> one its position only, and the third one its dimensions and position.
>
> HTH
> -- 
> - Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
> PragmaDev : Real Time Software Development Tools - 
> http://www.pragmadev.com
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>
Andrea Valle
Laboratorio multimediale "G. Quazza"
Facoltà di Scienze della Formazione
Università degli Studi di Torino
andrea.valle at unito.it




More information about the Python-list mailing list