I have this code:
import tkinter as tk
from tkinter import ttk
app_title = "Wordle-Klon" # Appens titel.
app_font = ("Arial", 20) # Applikation-vid typsnitt.
app_background_color = "yellow" # Bakgrundsfärg för appen.
window_width = 1000
window_height = 800
class App(tk.Tk):
def __init__(self):
super().__init__()
self.geometry('500x500')
self.initUI()
def initUI(self):
self.title = tk.Label(text=app_title, anchor="c", pady=20, font=app_font, bg='yellow', fg="black")
self.title.pack()
self.letterFrame = tk.Frame(self, bg="Blue")
self.letterFrame.pack(fill="both", expand=True, padx=20, pady=20)
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(0, weight=1)
self.createLetterSquares()
def createLetterSquares(self):
self.letters, self.rows = 1, 1
for i in range(5*5):
if self.letters == 6:
self.rows += 1
self.letters = 1
self.frame = tk.Frame()
self.label = tk.Label(text="("+str(self.rows)+", "+str(self.letters)+")", bg="red", padx=10, pady=10)
self.label.pack(in_=self.frame, anchor="c")
self.frame.grid(in_=self.letterFrame, row=self.rows, column=self.letters, sticky=tk.NSEW)
self.frame.grid_columnconfigure(self.letters, weight=1, uniform="True")
self.frame.grid_rowconfigure(self.rows, weight=1, uniform="True")
self.letters += 1
if __name__ == "__main__":
app = App() # Skapa ett app objekt.
app.mainloop() # Loopa appen.
I get a result that looks like:

How can I make the grid that is inside the frame, expand to fill the entire thing, rather than only using the minimum space necessary? I tried playing around with grid weights at the root (self.app) but it did not make any difference.
