【发布时间】:2015-09-28 06:20:11
【问题描述】:
我正在使用 20 个按钮,当单击任何一个按钮时,我正在调用“btn_click”函数。是否可以通过该函数知道按钮名称(按下哪个按钮)。请查找代码 sn-p下面。
t=['one','two','three','four','five','six','seven','untill to twenty']
for i in range(1,20):
obj=Button(root1,text=t[i],command=btn_click,width=27)
obj.grid(row=i,column=0,sticky=W,padx=15,pady=15)
【问题讨论】:
标签: python-2.7 button tkinter