Positioning a second GUI after closing the first in tkinter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Positioning a second GUI after closing the first in tkinter

I want to do the following (absolute beginner here :) : After start a gui will open with an ok button. It will start in the middle of the screen. After the closing of that gui a second will open on the same place. Problem: the second doesnt react to the positioning I ask. from tkinter import * start = Tk() start.geometry("300x300+533+234") start.mainloop() start.destroy() # I left out the button part in this example, the trouble comes after the closing of the first gui and opening the second. root = Tk() root.geometry("300x300+533+234") root.mainloop() This gui will open after the closing of the first but it will be positioned not at the location stated in root.geometry, but in the left upper corner of the screen. Why does the second gui neglect to go to the right position? Or is there another (better) way to get a kind of gui before getting to the main gui? Regards, William

15th Mar 2019, 9:33 AM
Willie de Wit
Willie de Wit - avatar
3 Answers
+ 2
You should NOT create more than one instance of Tk() in the same program. https://stackoverflow.com/questions/9640013/how-does-creating-two-instances-of-tk-work-with-one-mainloop
16th Mar 2019, 2:40 PM
Tibor Santa
Tibor Santa - avatar
+ 2
Good luck ;)
16th Mar 2019, 3:30 PM
Tibor Santa
Tibor Santa - avatar
+ 1
Hi there, Thanks! Good to know, so i can search for another direction in stead of getting lost . Many thanks!!
16th Mar 2019, 3:28 PM
Willie de Wit
Willie de Wit - avatar