【发布时间】:2020-03-04 19:16:43
【问题描述】:
for bear in self.bears:
button=tk.Button(self,text=polar.spec(),command=lambda
id=polar.spec:self.polar_ad(id))
button.grid(row=_r,column=_c,sticky=W+E+N+S)
_row+=1
您好,所以我在 for 循环中创建了许多按钮,但是当我单击按钮时,我希望能够禁用它。如果按钮是单独创建的,那么我可以使用
button["state"]="disabled"
但是我怎样才能通过使用按钮的 id 来使用它呢?谢谢
【问题讨论】:
-
这能回答你的问题吗? How to access one Button in a grid of Button
标签: python python-3.x tkinter