How to specify where a Tkinter window should open?

TkinterPythonGUI-Programming

Tkinter window can be configured using the Geometry Manager. When we specify the main window using the geometry(width x height + position_right + position_left) method, then we generally enable the window to open in a particular position.

Example

#Import the required libraries
from tkinter import *

#Create an instance of Tkinter Frame
win = Tk()

#Set the geometry
win.geometry("700x350+300+300")

#Create a Label
Label(win, text="This Window Opens at (300,300)", font=('Helvetica 15 bold')).pack(pady=30)
win.mainloop()

Output

Running the above code will display a window at the specified position with a label text.

raja
Published on 25-May-2021 08:38:57
Advertisements