Then you are gridding something else that expands these columns.
Don't know what the following means. There are only 3 columns on the keypad.
This code works as expected, which says that the problem is in some other part of your code. And note that this code does not use a class because it is just a small snippet.
Quote:put the buttons in a separate frame so you don't have outside widgets that control the size of the buttons
Don't know what the following means. There are only 3 columns on the keypad.
Quote:but there was still spacing in between the 147 Column and the 258 Column.
This code works as expected, which says that the problem is in some other part of your code. And note that this code does not use a class because it is just a small snippet.
import tkinter as tk from functools import partial master=tk.Tk() def callback(btn_num): print("btn_num=%s [%s] pressed" % (btn_num, keypad[btn_num])) keypad = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#'] # create and position all buttons with a for-loop # r, c used for row, column grid values r = 4 c = 0 n = 0 tk.Label(master, text="".join(["This is a really, really, really, ", "long label which will make this ", "single column very large"]), bg="lightblue").grid(row=0, column=0) ## a separate frame for the keys, so the long Label ## will not affect these column sizes fr=tk.Frame(master, bg="yellow") fr.grid(row=10, sticky="w") ## left side btn_list=[] for label in keypad: btn_list.append(tk.Button(fr, text=label, font='size, 18', width=4, height=1, command=partial(callback, n))) btn_list[-1].grid(row=r, column=c, ipadx=10, ipady=10) # increment button index n += 1 # update row/column position c += 1 if c > 2: c = 0 r += 1 master.mainloop()