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 of 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.

Create and Publish Google Workspace Add-ons with Apps Script Course 300px

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. 

Want to learn how to automate your daily admin at work with Python? Udemy has some great Python automation courses that will help you learn how to automate your tasks so you can focus on what really matters.

Got a more specific problem you need help with, but don’t have the time to develop the skills? Fiverr’s your best bet to find a skilled professional to solve your problem quickly and cheaply. *  

*The above affiliate links have been carefully researched to get you to what you specifically need. If you decide to click on one of these links it will cost you just the same as going to the site. If you decide to sign up, I just get a little pocket money to help pay for the costs of running this website.

Leave a Reply