【发布时间】:2014-08-06 11:33:06
【问题描述】:
我希望我的 Radiobuttons 使用本页中提到的按钮框界面,方法是设置 indicatoron=0:
http://effbot.org/tkinterbook/radiobutton.htm
代码sn-p:
import ttk
...
self.selectedSectionCode = StringVar()
self.selectedSectionCode.set("abc")
abcButton = ttk.Radiobutton(self, text='ABC', variable=self.selectedSectionCode, value='abc', indicatoron= 0)
abcButton.grid(column=0, row=1, sticky=(N,W))
但是,当我运行我的代码时,我收到以下错误:
File "C:\Users\...\view.py", line 473, in __init__
abcButton = ttk.Radiobutton(self, text='ABC', value='abc', indicatoron = 0)
File "C:\Python27\lib\lib-tk\ttk.py", line 1073, in __init__
Widget.__init__(self, master, "ttk::radiobutton", kw)
File "C:\Python27\lib\lib-tk\ttk.py", line 560, in __init__
Tkinter.Widget.__init__(self, master, widgetname, kw=kw)
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1974, in __init__
(widgetName, self._w) + extra + self._options(cnf))
clError: unknown option "-indicatoron"
我不确定为什么这不起作用,并且该站点上有几个示例提到了 Radiobutton 小部件使用的此选项,这些用户也使用 Python 2.7。
我的代码中是否缺少某些内容?
【问题讨论】:
标签: python python-2.7 tkinter