Tkinter columnconfigure weight not adjusting Tkinter columnconfigure weight not adjusting tkinter tkinter

Tkinter columnconfigure weight not adjusting


columnconfigure() or rowconfigure() functions are applied to the window or frame, of which the widget is a part of. Here you are applying it on the button itself. Apply it on on its parent basically.

Here is a small example.

import tkinter as tkapp = tk.Tk()bttn1 = tk.Button(app, text="I do nothing")bttn2 = tk.Button(app, text='Me too!')bttn3 = tk.Button(app, text='Same here!')bttnCt = tk.Button(app, text='Total Clicks: 0')bttn1.grid(row=0, column=0, sticky="ew")bttn2.grid(row=0, column=1, sticky="ew")bttn3.grid(row=0, column=2, sticky="ew")bttnCt.grid(row=1, column=1, sticky="ew")bttn_list = [bttn1, bttn2, bttn3, bttnCt]for i in range(len(bttn_list)):    app.columnconfigure(i, weight=1) ## Not the button, but the parentapp.mainloop()

enter image description here