How Do I Change the Size and Position of the Main Window in Tkinter and Python 3

Python 3, Tkinter 8.6. GUI examples in Windows 10

When you create your first window in Tkinter, you can set it’s starting size and position on the screen by using the geometry method.

When using this method, note that it only provides the window with the size and position when it is initialized. This means that the user can then change the size or the window and move it once it has first been put on the screen.

Initial Window Size

In Line 8 geometry is called to the root window. Inside the brackets, we first set the Width to 500 pixels and the Height to 100 pixels. Note that we are using a lowercase “x” here instead of a “*” to essentially say: I want the window to be 500 pixels by (x) 100 pixels.

tkinter Window Size - Python 3
500 wide by 100 high in Windows 10

Initial Window Position

When the first Tkinter window is run, it will usually appear in the top left hand corner by default.

To change this we can add the height and width position to the geometry method.


When Tkinter positions a window it references the top left corner of the window.

Here, we position the top left corner of the window right 300 pixels and down 300 pixels.

The geometry method in Line 8 now contains the following:

.geometry("window width x window height + position right + position down")

Note the “+” symbol before each position.

tkinte rWindow Position - Python 3 in Windows 10
Window position displayed in Windows 10

You can also just set the position of the window without adding the window width or height.

Because we are not setting the width or height. Tkinter will automatically adjust its size to a 200 by 200 pixel window.

tkinter Window Position Only - Python 3
Setting only the window’s position in Windows 10

*”Window size” ? Yes, I have a dumb sense of humour. 

2 thoughts on “How Do I Change the Size and Position of the Main Window in Tkinter and Python 3”

Leave a Reply

Your email address will not be published. Required fields are marked *