I wrote a little program a while back that changes windows a lot and I was wondering if there is a way to have one window open at the same spot the last window closed?

I guess I phrased my question badly I want the window to be opened where ever the user dragged the last one to. I know how to control size and position I was hoping to track where it got moved to. such as if it starts at

root.geometry('50x150+100+100')

and then gets moved to

root.geometry('50x150+125+99')

is there a way to find the window location before closing?

Edited 6 Years Ago by Thropian: n/a

well I found this

root.protocol("WM_DELETE_WINDOW", handler)

def handler():
    print "good bye"

but I can't find the window position when it was closed

Search for something like geometry in Tkinter's winfo, which you would have to call at the time the first window closes. I've never done anything like this so am not sure if it will work or not, so post back with any success or failure for future question.

Edited 6 Years Ago by woooee: n/a

info_window = {}

info_window["x"] = root.winfo_x()
info_window["y"] = root.winfo_y()
root.destroy()

root.geometry('300x200+%d+%d' % (info_window["x"], info_window["y"]))

thanks for the help woooee

Edited 6 Years Ago by Thropian: n/a

This question has already been answered. Start a new discussion instead.