无法设置ttk.Checkbutton的fg或前景

时间:2017-06-01 20:22:13

标签: python ttk

用一些kwargs实例化ttk.Checkbutton。其中一个kwargs是foreground,我得到了TclError: unknown option "-foreground"。如果我删除foreground,则可以使用。

这里是在PyCharm中看到的代码行和调用之前的值......

Pycharm Debug

widgetttk.Checkbutton。这是错误...

  File "...widget.py", line 76, in add_widget_and_position
    **widget_kwargs)
  File "C:\Python27\lib\lib-tk\ttk.py", line 633, in __init__
    Widget.__init__(self, master, 'ttk::checkbutton', kw)
    |               |     |                           -> {'foreground': 'purple', 'text': u'Free to air', 'width': None, 'state': 'normal', 'command':  at 0x04881970>,...
    |               |     -> 
    |               -> 
    -> 
  File "C:\Python27\lib\lib-tk\ttk.py", line 555, in __init__
    Tkinter.Widget.__init__(self, master, widgetname, kw=kw)
    |                       |     |       |              -> {'foreground': 'purple', 'text': u'Free to air', 'width': None, 'state': 'normal', 'command':  at 0x04881970>,...
    |                       |     |       -> 'ttk::checkbutton'
    |                       |     -> 
    |                       -> 
    -> 
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 2091, in __init__
    (widgetName, self._w) + extra + self._options(cnf))
TclError: unknown option "-foreground"

有谁能看到我在这里做错了什么?希望它简单而愚蠢:/

0 个答案:

没有答案