Python 如何禁用Pmw.ButtonBox中的特定按钮?
我添加了一个按钮,如下所示:Python 如何禁用Pmw.ButtonBox中的特定按钮?,python,tkinter,Python,Tkinter,我添加了一个按钮,如下所示: def addButtons(self): self.buttonBox = Pmw.ButtonBox(self.dataFrame, labelpos = 'nw', label_text = '', frame_borderwidth = 1, frame_relief = 'groove') self.buttonBox.pack() se
def addButtons(self):
self.buttonBox = Pmw.ButtonBox(self.dataFrame,
labelpos = 'nw',
label_text = '',
frame_borderwidth = 1,
frame_relief = 'groove')
self.buttonBox.pack()
self.buttonBox.place(relx=.75, rely=.750, anchor=W)
# Add some buttons to the ButtonBox.
self.buttonBox.add('Login', command = self.login)
# Set the default button (the one executed when <Return> is hit).
self.buttonBox.setdefault('Login')
self.dataFrame.bind('<Return>', self._processReturnKey)
self.dataFrame.focus_set()
def添加按钮(自身):
self.buttonBox=Pmw.buttonBox(self.dataFrame,
labelpos='nw',
标签文本=“”,
边框宽度=1,
框架(浮雕=‘凹槽’)
self.buttonBox.pack()
self.buttonBox.place(relx=0.75,rely=0.750,anchor=W)
#在按钮框中添加一些按钮。
self.buttonBox.add('Login',command=self.Login)
#设置默认按钮(点击时执行的按钮)。
self.buttonBox.setdefault('Login')
self.dataFrame.bind(“”,self.\u processReturnKey)
self.dataFrame.focus\u set()
现在,我想禁用登录按钮时,用户按下它。我该怎么做?我找到了简单按钮的答案,但该按钮位于按钮框中。根据,添加方法返回对所创建按钮的引用。因此,只需保存它返回的引用,然后像配置任何其他按钮一样配置该按钮