I want to make a 4x5 buttons list so I did this in python:
for i in range(4):
seats_btn_row = []
for j in range(5):
btn = Button(self.fra_seats, text = str(i+1) + "-" + str(j+1), image = self.img_seat_takable, command = self._on_button_clicked
btn.bind("<Button-1>", self.callback)
btn.grid(row = i+1, column = j+1)
seats_btn_row.append(btn)
self.seats_btn_list.append(seats_btn_row)
self.fra_seats.grid(row = 2, column = 1)
it looks like this:
and in the self._on_button_clicked
function, I want to know which button I have pressed(the row and the column of the button), actually I tried to get the button's text attributes but failed to make it.
Is there any way to know some information of the ButtonPressEvent
's source button?
I have tried .bind
function and command parameter