How to get grid information from pressed Button in tkinter?

前端 未结 3 2022
深忆病人
深忆病人 2021-01-14 13:13

I need to create table of buttons using Tkinter in Python 2.7, which has n rows and n columns, and has no button in bottom right corner.

P

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-14 14:14

    You can pass the row and column by using a lambda expression for the button:

    button = Button(..., command=lambda row=i, column=j: doSomething(row, column))
    

提交回复
热议问题