Displaying Toplevel window in user specified location.................
Jørgen Cederberg
jorgencederberg at hotmail.com
Mon May 12 05:34:34 EDT 2003
Python-lover wrote:
> hi,
> how to place a toplevel window in a loaction
> specified by the user? I have a button in main window.
> I want to display a toplevel window in a location ,say
> (100,100), if i click the button.
Hello Python-lover
you've asked a lot of Tkinter question (8 since 28 april 2003 according
to google) which is perfectly okay. On the other hand you could have
found the answers to the questions by your self if you had browsed the
Tkinter documentation at:
http://www.pythonware.com/library/tkinter/introduction/index.htm
The answer to your question can be found here:
http://www.pythonware.com/library/tkinter/introduction/x9867-window-geometry-methods.htm
You have to use the geometry method on the Toplevel window. The offset
variables control the position of the window.
tw = Toplevel(root)
width = 200
height = 160
xoffset = 100
yoffset = 100
tw.geometry("%dx%d%+d%+d" % (width, height, xoffset, yoffset)
Hope this helps
Jorgen Cederberg
More information about the Python-list
mailing list