Tkinter单选按钮指示器未被识别
我想让我的单选按钮使用这个页面提到的按钮框界面,通过设置indicatoron=0来实现:
http://effbot.org/tkinterbook/radiobutton.htm
代码片段:
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"
我不太明白为什么这不工作,这个网站上有几个例子提到这个选项是单选按钮小部件使用的,用户们也在使用Python 2.7。
我的代码里是不是缺少了什么?