Vgfg

Ggg

from tkinter import *               # графическая библиотека
from random import shuffle          # перемешать список suffle(A)

column = 4                          # столбцы
row = 4                             # строки
btn = []                            # список кнопок
key = '+-/*123←456=7890'
s = ''

def play(n):                        # функция обработчик нажатия на кнопку
    global s
    if n == 11:
        s = str(eval(s))
    elif n == 7:
        s = s[0:-1]
    else:
        s += key[n]
    msg.config(text=s)

msg = Message(width=500, font =("mono", 16, "bold"))
msg.pack(expand=YES, fill= BOTH)
for i in range(row):
    f = Frame()
    f.pack(expand=YES, fill=BOTH)
    for j in range(column):
        btn += [Button(f, font =("mono", 16, "bold"), width = 5, height=3)]
        btn[-1].pack(expand=YES, fill=BOTH, side=LEFT)
        btn[-1].config(text = key[i*column+j], command=lambda n=i*column+j:play(n))

mainloop()

Tgg