Tkinter radiobutton指标未被识别

Ale*_*eph 1 python tkinter python-2.7

我希望我的Radiobuttons使用本页提到的按钮框界面,通过设置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))
Run Code Online (Sandbox Code Playgroud)

但是,当我运行我的代码时,我收到以下错误:

  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"
Run Code Online (Sandbox Code Playgroud)

我不确定为什么这不起作用,本网站上有几个例子提到Radiobutton小部件使用的这个选项,也是使用Python 2.7的用户.

我的代码中是否缺少某些内容?

Kev*_*vin 6

您链接的文档适用于Tkinter.Radiobutton该类.您正在使用ttk.Radiobutton不支持indicatoron属性的类.