exact x,y positioning of a Tk widget

Eric Brunel eric.brunel at pragmadev.com
Fri Aug 30 06:03:37 EDT 2002


revyakin wrote:
> Is there a way to position a widget with exact x,y coordinates,
> instead of just justifying to the left, right, top and bottom?

You may also use the "place" method:

from Tkinter import *
root = Tk()
b = Button(root, text='OK')
b.place(x=20, y=30)

This does exactly what you want. But consider understanding, then using the 
"grid" method: it's far more adaptable than "pack" or "place" methods. It 
particularly handles a lot better window resizing.

HTH
-- 
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com



More information about the Python-list mailing list