class Calc:
def __init__(self):
ls = ("1", "2", "3", "4", "5", "6", "7", "8", "9", "-", "+", "/", "x", "=", "a", ".")
column = 5
row = 5
count = 2
for x in ls:
bt=Button(root, text=x, command="")
for y in x:
bt.grid(row=(row), column=(column))
column = column + 1
count = count + 1
if count> row:
column = column-4
row = row +4
cal=Calc()
Above is my code. My question is how can I call a function so that the button pressed, for instance button 1, prints 1 into the console. Only seem to be able to print the whole list of 1, 16 buttons or I can print the very last position in the list which is ".". I can't print 1 or 2 or 3 etc?