In order to place a tkinter window at the center of the screen, we can use the PlaceWindow method in which we can pass the toplevel window as an argument and add it into the center.
We can also set the window to its center programmatically by defining its geometry.
#Import the tkinter library from tkinter import * #Create an instance of tkinter frame win = Tk() #Set the geometry win.geometry("600x250") win.eval('tk::PlaceWindow . center') win.mainloop()
Running the above code will create a centered window.