前景的集合ttk.检查按钮

2024-04-19 16:53:36 发布

您现在位置:Python中文网/ 问答频道 /正文

在实例化ttk.检查按钮用一些夸克。其中一个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"

有人能看出我做错了什么吗?希望它简单而愚蠢:/


Tags: inpyselfinitliblinewidgetkwargs