import calendar
import datetime
from functools import partial
def changeBut (event, but, i):
but["bg"] = "green"
p.append(i)
print(i)
print(p)
def left_click(event, i):
print(but.text[i])
p = []
m = datetime.date.today()
dof = ['Vs DSdsada','DDDa aaAAAA']
a = calendar.monthrange(m.year, m.month)
root = Tk()
i = 0
s = a[1]+1
de = []
while i < s:
if i == 0:
Label(root, text = '').grid(row = 1, column = i+1)
i+=1
continue
Label(root, text = str(i)).grid(row = 1, column = i+1)
i+=1
i = 0
myrow = 0
while i<s:
if i == 0:
Label(root, text=dof[0]).grid(row = 2, column = i+1)
i+=1
continue
but = Button(root, text=i, textvariable=i)
but.bind("<Button-1>", lambda event, but=but: changeBut(event, but, i))
#but.bind('<Button-1>', left_click(event, i))
but.grid(row = 2, column = i+1)
i+=1
root.mainloop()
в масcиве 'p' нужно сохранить 'textvariable' нажатой кнопки
у меня пока вот так: