0

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?

2
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by woooee
0

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 by Thropian: n/a

0

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

1

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 by woooee: n/a

0
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 by Thropian: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.