gpt4 book ai didi

python - 如何禁用 Pmw.ButtonBox 中的特定按钮?

转载 作者:行者123 更新时间:2023-12-01 06:08:23 24 4
gpt4 key购买 nike

我添加了一个按钮:

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

现在,我想在用户按下登录按钮时禁用它。我怎样才能做到这一点?我找到了简单按钮的答案,但该按钮位于按钮框中。

最佳答案

根据pmw.ButtonBox documentationadd 方法返回对所创建按钮的引用。因此,只需保存它返回的引用,然后像配置任何其他按钮一样配置该按钮。

关于python - 如何禁用 Pmw.ButtonBox 中的特定按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7000081/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com