You didn't way what the preferred behavior is, only that what it's doing is wrong. I don't know if this suggestion will do what you want or not.

As a rule of thumb, when you use grid you should always give at least one row and one column a weight for the parent containing the widgets being managed. While you do that for widgets in the container, you don't do it for the root window. Therefore, widgets inside the container might be resizing properly, but you won't see it because the container itself isn't resizing.

If you're only going to put a single widget inside another widget, I recommend using pack because you can do everything in a single line of code. Therefore, I recommend using pack rather than grid for the container itself:

container.pack(fill="both", expand=True)

Also, since your container seems to only have a single row and a single column, you probably don't want to give column 1 a weight.

Finally, you are also using grid to manage the widgets inside each page (N1, N2), but again, you are forgetting to give a weight to any rows or columns inside those frames.

Answer from Bryan Oakley on Stack Overflow
🌐
Python Forum
python-forum.io › thread-755.html
Getting Tkinter Grid Sizing Right the first time
November 6, 2016 - Hello, Introduction: This is a subject that is asked over and over again. Laying out a tkinter GUI and having it resize properly can be a daunting task. It doesn't have to be, if a few simple rules are followed. The basis for the code presented h...
Discussions

tkinter - Adjust widget size according to window size using grid geometry and screen size - Stack Overflow
I want to use grid geometry to change the size of widget according to size of window(maximize or minimize). Example: If a window is made and its look fulfilled in minimize mode but on expanding... More on stackoverflow.com
🌐 stackoverflow.com
python - How to create a self resizing grid of buttons in tkinter? - Stack Overflow
I am trying to create a grid of buttons(in order to achieve the clickable cell effect) with Tkinter. My main problem is that I cannot make the grid and the buttons autoresize and fit the parent w... More on stackoverflow.com
🌐 stackoverflow.com
python - Tkinter grid and widget size - Stack Overflow
I am actually learning Tkinter and I want to do a window looking like this (tetris GUI) : image So I want to do a 20x15 grid (h x w) with a tile size of 25px (so 500px x 375px playArea size) So h... More on stackoverflow.com
🌐 stackoverflow.com
python - Resisze grid to fit tkinter window - Stack Overflow
Hey so im trying to get to grips with tkinter so i can use it fully in my programs, however im struggling with the geometry manager, grid. I want my program to resize the grid, based upon the size... More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › TomSchimansky › CustomTkinter › discussions › 298
Is it possible to let the window auto-size to fit all widgets without overlaps? · TomSchimansky/CustomTkinter · Discussion #298
Yes, I use "grid" to place the widgets (on the grid). But using self.geometry(widthxheight) would mean that I define fixed dimensions which I try to avoid. Here is the code of the example from above: How would I need to adjust it so that all widgets are shown and not truncated resp hidden. from tkinter import * import customtkinter as ctk class TestApp(ctk.CTk): def __init__(self): super().__init__() # self.geometry("500x300") # self.minsize(300,200) self.protocol("WM_DELETE_WINDOW", self.on_closing) label1 = ctk.CTkLabel(self, text="testttttttttt", text_font=("Arial", 20)) label1.grid(row=1,
Author   TomSchimansky
🌐
Tkinter
tkinter.com › dynamically-resize-buttons-when-resizing-a-window-python-tkinter-gui-tutorial-145
Dynamically Resize Buttons When Resizing a Window – Python Tkinter GUI Tutorial #145 – TKinter.com
November 17, 2020 - In this video I’ll show you how to dynamically resize buttons whenever you resize an app Window using Tkinter and Python. We’ll use the grid system and something called Grid.rowconfigure() and Grid.columnconfigure() to dynamically resize to fit the container that they’re in, and automatically resize themselves if the user manually changes the size of the app.
🌐
15. The Menu widget
anzeljg.github.io › rin2 › book2 › 2405 › docs › tkinter › root-resize.html
4.4. Making the root window resizeable
The argument sticky=tk.N+tk.S+tk.E+tk.aW to self.grid() is necessary so that the Application widget will expand to fill its cell of the top-level window's grid. Next: 5. Standard attributes ... Previous: 4.3. Configuring column and row sizes
🌐
Plus2Net
plus2net.com › python › tkinter-geometry.php
Managing geometry of Tkinter window
February 5, 2019 - import tkinter as tk my_w = tk.Tk() # parent window width,height=300,200 v_dim=str(width)+'x'+str(height) my_w.geometry(v_dim) # Size of the window #my_w.minsize(280, 180) # (minimum ) Width , ( minimum ) height #my_w.maxsize(320,220) # (maximum ) width , ( maximum) height my_w.title("www.plus2net.com") # Adding a title def my_resize(condition): global width , height if(condition=='increase'): width=width+10 height=height+10 elif(condition=='decrease'): width=width-10 height=height-10 d=str(width)+"x"+str(height) my_w.geometry(d) # update the new width and height b1=tk.Button(my_w,text='zoom +
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › resize-background-image-to-window-size-with-tkinter-grid-manager
Resize background image to window size with Tkinter grid manager?
In this article, we have explored the process of resizing a background image to fit the window size using the Tkinter grid manager. By utilizing the grid manager and binding a resize event to the window, we can achieve a visually appealing and immersive user interface.
🌐
TutorialsPoint
tutorialspoint.com › dynamically-resize-buttons-when-resizing-a-window-using-tkinter
Dynamically Resize Buttons When Resizing a Window using Tkinter
March 4, 2021 - #Importing the tkinter library from tkinter import * win= Tk() win.title("Dynamically Resize Buttons") win.geometry("700x500") #Configure Rows and column Grid.rowconfigure(win, 0,weight=1) Grid.columnconfigure(win,0,weight=1) #Create buttons b1= Button(win, text= "C++") b2= Button(win, text= "Java") #Create List of buttons bl= [b1, b2] row_no=0 #Loop through all the buttons and configure it row-wise for button in bl: Grid.rowconfigure(win,row_no, weight=1) row_no+=1 #Adjust the position in grid and make them sticky b1.grid(row=0, column=0, sticky= "nsew") b2.grid(row=1, column=0, stick= "nsew") win.mainloop() Running the above code will generate the output and display two buttons horizontally in a row−order, which can be dynamically resizable according to screen or window size.
Top answer
1 of 4
91

You need to configure the rows and columns to have a non-zero weight so that they will take up the extra space:

grid.columnconfigure(tuple(range(60)), weight=1)
grid.rowconfigure(tuple(range(30)), weight=1)

You also need to configure your buttons so that they will expand to fill the cell:

btn.grid(column=x, row=y, sticky="news")

This has to be done all the way up, so here is a full example:

from tkinter import *

root = Tk()
frame = Frame(root)
root.rowconfigure(0, weight=1)
root.columnconfigure(0, weight=1)
frame.grid(row=0, column=0, sticky="news")
grid = Frame(frame)
grid.grid(sticky="news", column=0, row=7, columnspan=2)
frame.rowconfigure(7, weight=1)
frame.columnconfigure(0, weight=1)

#example values
for x in range(10):
    for y in range(5):
        btn = Button(frame)
        btn.grid(column=x, row=y, sticky="news")

frame.columnconfigure(tuple(range(10)), weight=1)
frame.rowconfigure(tuple(range(5)), weight=1)

root.mainloop()
2 of 4
47

@Vaughn Cato gave an excellent answer here. However, he has accidentally included a bunch of extraneous code in his example. Here is a cleaned up and more organized full example doing exactly what his example does.

from tkinter import *

#Create & Configure root 
root = Tk()
Grid.rowconfigure(root, 0, weight=1)
Grid.columnconfigure(root, 0, weight=1)

#Create & Configure frame 
frame=Frame(root)
frame.grid(row=0, column=0, sticky=N+S+E+W)

#Create a 5x10 (rows x columns) grid of buttons inside the frame
for row_index in range(5):
    Grid.rowconfigure(frame, row_index, weight=1)
    for col_index in range(10):
        Grid.columnconfigure(frame, col_index, weight=1)
        btn = Button(frame) #create a button inside frame 
        btn.grid(row=row_index, column=col_index, sticky=N+S+E+W)  

root.mainloop()

Screenshots:

When it first opens (small):

After you maximize the window:

TODO

  1. [ ] 3 Aug. 2023: Update & modernize my example. Some changes occurred to the main answer that I should look at.
  2. [ ] 3 Aug. 2023: Remove from tkinter import *, and use import tkinter instead, as it's bad practice to import all. It's better to see explicitly where each object comes from by using a module's namespace explicitly.
🌐
Python Tutorial
pythontutorial.net › home › tkinter tutorial › tkinter grid
Tkinter Grid Geometry Manager - Python Tutorial
April 4, 2025 - In this example, we’ll use the grid geometry manager to design a login screen as follows: The login screen uses a grid that has two columns and three rows. Also, the second column is three times as wide as the first column: ... import tkinter as tk from tkinter import ttk # main window root = tk.Tk() root.geometry("240x100") root.title('Login') # grid 3x2 root.rowconfigure(0, weight=1) root.rowconfigure(1, weight=1) root.rowconfigure(2, weight=1) root.columnconfigure(0, weight=1) root.columnconfigure(1, weight=3) # username username_label = ttk.Label(root, text="Username:") username_label.gr
🌐
py4u
py4u.org › blog › python-tkinter-resize-widgets-evenly-in-a-window
How to Resize Tkinter Grid Widgets Evenly with Window in Python
Resizing Tkinter grid widgets evenly is straightforward once you master two tools: rowconfigure/columnconfigure with weight=1 to make rows/columns expand. ... By combining these, you can build responsive UIs that adapt to any window size.
🌐
Reddit
reddit.com › r/tkinter › need help with resizing
r/Tkinter on Reddit: Need Help with resizing
May 21, 2022 -

Hey guys!

I am currently making a GUI using tkinter. I am using the grid geometry manager for placing widgets on the window.

I want the window to be resizable and I want the widgets to expand as well, exactly how the code is running at the moment. But I dont want the widgets to scale to the window 1:1.

The pictures below will make you understand what I mean better:

Default size of the window

When I expand it a little

Full Screen

As you noticed, the widgets are very far apart. I do not like this!

I want the widgets to grow far apart but not at this rate. Maybe half the rate at which the window is growing. At full screen, I want it to look something like this instead of the actual result. Forgive me I just overlapped 2 images in paint for visualizing it. There actually wont be 2 titlebars in the window. Only the outside titlebar will exist.

What I want the full screen window to look like

Please help me out with this, its urgent!!!!!

Link to the full code is here ...

https://drive.google.com/file/d/1zT4VYMRPz2WZHiSfQ3mdIY-OkJ6QrvY4/view?usp=sharing

🌐
YouTube
youtube.com › codemy.com
Dynamically Resize Buttons When Resizing a Window - Python Tkinter GUI Tutorial #145 - YouTube
In this video I'll show you how to dynamically resize buttons whenever you resize an app Window using Tkinter and Python.We'll use the grid system and someth...
Published   November 17, 2020
Views   34K
🌐
GeeksforGeeks
geeksforgeeks.org › dynamically-resize-buttons-when-resizing-a-window-using-tkinter
Dynamically Resize Buttons When Resizing a Window using Tkinter - GeeksforGeeks
September 4, 2021 - The grid() geometry manager organizes widgets in a table-like structure in the parent widget. The master widget is split into rows and columns, and each part of the table can hold a widget. It uses column, column span, ipadx, ipady, padx, pady, row, row span, and sticky. ... # Import module from tkinter import * # Create object root = Tk() # Adjust size root.geometry("500x500") # Create Buttons button_1 = Button(root,text="Button 1") button_2 = Button(root,text="Button 2") # Set grid button_1.grid(row=0,column=0) button_2.grid(row=1,column=0) # Execute tkinter root.mainloop()
🌐
Python Guides
pythonguides.com › python-tkinter-window-size
How To Set And Manage Window Size In Python Tkinter?
March 19, 2025 - When the window is resized, the labels will automatically adjust their size to fill the available space evenly. Check out How to convert Python file to exe using Pyinstaller · The grid Geometry Manager allows you to arrange widgets in a grid-like structure. It provides more precise control over the layout compared to the pack geometry manager. Here’s an example: import tkinter as tk window = tk.Tk() label1 = tk.Label(window, text="Label 1", bg="red") label1.grid(row=0, column=0, sticky=tk.NSEW) label2 = tk.Label(window, text="Label 2", bg="blue") label2.grid(row=0, column=1, sticky=tk.NSEW) label3 = tk.Label(window, text="Label 3", bg="green") label3.grid(row=1, column=0, columnspan=2, sticky=tk.NSEW) window.grid_rowconfigure(0, weight=1) window.grid_rowconfigure(1, weight=1) window.grid_columnconfigure(0, weight=1) window.grid_columnconfigure(1, weight=1) window.mainloop()
🌐
15. The Menu widget
anzeljg.github.io › rin2 › book2 › 2405 › docs › tkinter › grid-config.html
4.3. Configuring column and row sizes
Table 2. Column and row configuration options for the .grid() geometry manager · Next: 4.4. Making the root window resizeable