我有一个Tk/Pmw接口,它有一系列Pmw.RadioSelect
小部件,只有其中的一些应该有活动的检查按钮。根据Pmw docs,可以使用下划线配置组件(如RadioSelect小部件中的Tkinter.Checkbutton
)以指示继承。在该页面上的示例中,可以按照以下方式配置Pmw.Counter
兆字节组件Entryfield
组件中的Tkinter.Entry
窗口小部件的背景,该组件位于。如何配置Pmw RadioSelect检查按钮的状态?
counter.configure(entryfield_entry_background = 'yellow')
对于RadioSelect窗口小部件,但是,按钮组件及其继承的名称没有明确的文件中给出的,因为按钮可以是不同类型(button
,radiobutton
和checkbutton
)。
如何配置RadioSelect
小部件的Checkbutton
组件?基本上我只需要正确的字符串作为参数传递来配置。我做了一些搜索和试验性错误,还没有找到正确的参数名称。
仅供参考,以下是我目前为止的简化版本。这是一个单独的项目列表,可以选中或取消选中,但某些复选框应该处于非活动状态。
for i, f in enumerate(foo):
# Create the RadioSelect widget
chk = Pmw.RadioSelect(parent,
buttontype='checkbutton',
command=self.checkbutton_callback)
# Add a numbered checkbutton
chk.add(str(i))
# Place it on the grid
chk.grid(row=i, column=0)
# Without the following code, it works fine, but all the buttons are enabled
# With it, the program chokes on the `configure()` call
if not f.active:
print "This gets printed."
chk.configure(checkbutton_state='disabled')
print "But this doesn't."
显然checkbutton_state
在第二到最后一行是错误的参数名称。我应该用什么来代替?