如何在中禁用特定按钮按钮盒?

2024-04-26 12:55:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我添加了一个按钮:

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()

现在,我想在用户按下登录按钮时禁用它。我怎么能做到呢?我找到了简单按钮的答案,但这个按钮在按钮盒中。在


Tags: theselfdataframereturndeflogin按钮frame